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.
  • This all works great thanks. Just one question, is it possible to add extra PDF files from file to the end of this PDF ? I'm assuming not, but though I'd double check.
  • Hi Andy,

    Starting with RB 21, you can use the PDFComponent to add existing PDF files to a report. The PDFComponent can be found on the "Advanced Components" toolbar in the designer. See the following article and help topics for more information.

    https://rbwiki.digital-metaphors.com/rcl/pdfcomponent/fundamentals/

    Note: The PDFComponent behaves like a Section Subreport. If you would like to add PDF files to the end of your existing report, I recommend creating a new "container" report with a detail band only. Inside the detail is a section subreport containing your original report, then add PDF components as needed below.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.