Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Print with PDF printer to the pdf file

edited January 2018 in General
Hi!

Up to now we are printing PDF documents with the help of Pragnaan
ReportBuilder Export Devices http://www.rarefind.com/rbpro/index.html.
We are using the code:

ppReport.SaveAsTemplate:=True;
ppReport.Template.SaveTo:=stDatabase;
ppReport.Template.DatabaseSettings.DataPipeline:=dpReport;
ppReport.Template.DatabaseSettings.NameField:='Name';
ppReport.Template.DatabaseSettings.TemplateField:='Template';
ppReport.Template.DatabaseSettings.Name:=AReportName;
ppReport.Template.LoadFromDatabase;
ppReport.CachePages := True;
ppReport.PassSetting := psTwoPass;
ppReport.AllowPrintToFile := True;

ppReport.Device:=dvFile;
ppReport.DeviceType:='PDF';
ppReport.TextFileName:=AFileName;
ppReport.ShowPrintDialog:=False;
ppReport.ShowCancelDialog:=False;
ppReport.ModalCancelDialog:=False;
ppReport.ModalPreview:=False;
ExportToPDF(ppReport, AFileName);

This code respects the special characters and diacritics we are using in
our ReportBuilder templates (this was the main reason for choosing
Pragnaan components) but we are not satisfied with the size of the
resulting files - they are 1MB and larger. If we are using PDF printers
in interactive mode (like Bullzip printer) (i.e. with dialog for file
path selection), then the size of file is only 40kb which is fine.

So - what is the code how to print ReportBuild report into PDF file
using PDF printer (like Bullzip) and without interactivity (without
showing the printer setup or printer file path dialog) and without
Pragnaan or any other non-ReportBuilder components.

Thanks in advance!
J.

Comments

  • edited January 2018

    The following code prints reports silently into PDF file, that is fine.
    But there is problem - diacritics in the static labels is replaced with
    strange characters. That is not acceptable.

    ppReport.Device:=dvPrinter;
    ppReport.PrinterSetup.PrinterName:='Bullzip PDF Printer';
    ppReport.DeviceType:='PDF';
    ppReport.TextFileName:=AFileName;
    ppReport.ShowPrintDialog:=False;
    ppReport.ShowCancelDialog:=False;
    ppReport.ModalCancelDialog:=False;
    ppReport.ModalPreview:=False;
    ppReport.Print;

    When I print the same report interactively using Bullzip PDF Printer,
    then there are no problems with diacritics. I guess that there is
    somehting wrong with ReportBuilder devices for printing into file.

  • edited January 2018
    I tried this code with PDF Architect 4 and PDFCreator as well, but all
    those PDF printers give strange characters instead of Baltic/Cyrillic
    characters when printing silently to file. When printing interactively,
    there is no problem.

    ppReport.Device:=dvPrinter;
    ppReport.PrinterSetup.PrinterName:='Bullzip PDF Printer';
    ppReport.DeviceType:='PDF';
    ppReport.TextFileName:=AFileName;
    ppReport.ShowPrintDialog:=False;
    ppReport.ShowCancelDialog:=False;
    ppReport.ModalCancelDialog:=False;
    ppReport.ModalPreview:=False;
    ppReport.Print;
  • edited January 2018
    Hi Jonatan,

    In your previous post(s) you mention that you are using Delphi 6 and RB
    11. If this is still the case, the solution is to upgrade your version
    of ReportBuilder and Delphi.

    The latest version of ReportBuilder fully supports exporting to PDF
    (silently) with Unicode characters (with a Unicode version of Delphi).

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.