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

Multiple reports into One PDF

Hi, I'm trying to locate this example but get 404 on the page. Is there a new link ?

The example shows how you can merge multiple reports into a single PDF file.
You would essentially be doing the same thing only with the same report over
and over again until you reach the proper number of copies.

http://www.digital-metaphors.com/rbWiki/Output/PDF/How_To...Merge_Multiple_Reports_into_one_PDF

Comments

  • I found a different link. It nearly works but the resulting PDF is only 1k and won't open, so I assume i've done something wrong. My code is below, I'm adding invoice items into 1 pdf.

    ppReport1.Template.DatabaseSettings.Name := cbTemplate.Text ;
    ppReport1.Template.LoadFromDatabase ;
    ppReport1.DeviceType := 'PDF';
    ppReport1.AllowPrintToFile := True;

    lPDFDevice := TppPDFDevice.Create(nil);
    lPDFDevice.PDFSettings := ppReport1.PDFSettings; // optionally assign PDFSettings from report
    lPDFDevice.PDFSettings.OpenPDFFile := False;
    lPDFDevice.FileName := TppFileUtils.GetApplicationFilePath + 'myReport.PDF';
    lPDFDevice.Reset;

    while not QryInvItemsSum.Eof do
    begin
    lPDFDevice.EndPrintJob := False;
    lPDFDevice.Publisher := ppReport1.Publisher;
    ppReport1.ShowPrintDialog := False ;

    ppReport1.PrintToDevices;
    lPDFDevice.StartPrintJob := False;

    dmData.QryInvItemsSum.Next ;
    end;

    lPDFDevice.EndPrintJob := True;
    lPDFDevice.Free;
  • I've seen other posts relating to PDF corruption that suggest this - but it makes no difference.
    DecimalSeparator := '.';
    ThousandSeparator := ',';

    ppFormatSettings.DecimalSeparator := DecimalSeparator;
    ppFormatSettings.ThousandSeparator := ThousandSeparator;

    Andy
  • More information. Using .ppReport1.Print create the PDF correctly but only creates the last report.
  • Hi Andy,

    All of our articles can be found at the following location: https://rbwiki.digital-metaphors.com/

    The article you are looking for is at the following link:
    https://rbwiki.digital-metaphors.com/output/pdf/how-to-merge-multiple-reports-into-one-pdf/

    I suggest downloading the example provided and looking at how it works. Pay particular close attention to the order in which the StartPrintJob and EndPrintJob properties are set and the PrintToDevices routine is called.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Thank you. Yes it was all down to the order.
Sign In or Register to comment.