Multiple AR reports to a single PDF

Posted by: jscorbitt on 4 August 2017, 2:32 pm EST

  • Posted 4 August 2017, 2:32 pm EST

    Hey AR Guys!

    Is it possible to export multiple AR reports to a single PDF.  I have several client reports that will be produced together, then printed at a later time and mailed by Customer Service Reps.  I want to ensure that no reports are missed.  I thought if I could merge them to a single PDF, it would be a great fix.

    BTW, I can't merge the AR reports themselves to a single as a large mix of these reports could occur depending on the situation.

  • Replied 4 August 2017, 2:32 pm EST

    It sounds like the reports will all be run at the same or nearly the same time.  As a possible solution, simply take their page collections and merge them together, I like using a blank/empty report with the same page setup. Then export the merged page collection.

    If the reports are not run at the same time.  You could store them as RDF files until the client was ready to create the PDF.  Load the RDFs, merge their page collections as above and then export to PDF.
  • Replied 4 August 2017, 2:32 pm EST

    I opened another Thread and the Mod tried to help me really, but im such a beginner in ActiveReports, i couldnt find the Problem. Ur idea with merging is very good, can u give me an small example or something?
  • Replied 4 August 2017, 2:32 pm EST

    nono, i can create everything ,but the user can put in an pagebreak, which makes, that at the end is an empty site(logical). And if i use this merging of 2 reports, there are 2 emtpy sites: for example:
    layout 1 page 1
    layout 1 p 2
    layout 1 p 3
    finish layout 1, but empty site
    layout 2 page 1
    layout 2 page 2
    finish layout 2, but empty site

    so i want to delete this empty sites, but i cant find a function, which helps me to find this.
    sry for my bad english btw :)

  • Replied 4 August 2017, 2:32 pm EST

    Your welcome.

    I am drawing a blank as to what "empty sites" might reference.

  • Replied 4 August 2017, 2:32 pm EST

    worked perfectly, thanks.
    Another question: Is there an easy function where i can find and/or delete empty sites?
  • Replied 4 August 2017, 2:32 pm EST

    Here is my basic merge code...

    <FONT face="Courier New">rptInsert.Run <FONT color=#0000ff>False</FONT></FONT>

    <FONT face="Courier New"><FONT color=#008000>'load backwards so indexes are correct when finished</FONT>
    <FONT color=#0000ff>For</FONT> intP = rptInsert.Pages.Count - 1 <FONT color=#0000ff>To</FONT> 0 <FONT color=#0000ff>Step</FONT> -1
        rptFinal.Pages.Insert 0, rptInsert.Pages.Item(intP)
    <FONT color=#0000ff>Next</FONT> intP

    <FONT face="Courier New"><FONT color=#008000>'ensure print dialog has correct page information</FONT>
    rptFinal.Printer.FromPage = 1
    rptFinal.Printer.ToPage = rptFinal.Pages.Count</FONT>

    <FONT face="Courier New" color=#008000>'show/print/export rptFinal as desired</FONT>

  • Replied 4 August 2017, 2:32 pm EST

    thx ill try this possibility out.
  • Replied 4 August 2017, 2:32 pm EST

  • Replied 4 August 2017, 2:32 pm EST

    ah ok, lets give a try.
    To the example:
    There are my 2 Layouts, each with pagecounter, but how u see, it doenst count the max sites, just the sites from each layout. Can i change this or is that impossible?

  • Replied 4 August 2017, 2:32 pm EST

    You could use the DrawText method and a loop to fill in the max pages after you have finished merging and commited.
  • Replied 4 August 2017, 2:32 pm EST

    I am a bit daft here I guess, short on coffee or something, as I am still not latching onto this “empty site” concept. Can you attach an example? The 7 page PDF you outlined would be perfect for such.

  • Replied 4 August 2017, 2:32 pm EST

    Hello again,
    I made everything how u said, made 2 Reports, merged and commited them.
    That works fine, but now one problem stayed: If the user wants to see the page and maxpages, it just shows them from the actual report. I attached an pdf to show the problem. the page and max page is made of some active reports functions, is it possible, that i can change this that it shows the pages of the merged reports? In the example it should be 1/4 2/4 etc not 1/2 2/2 etc...

    edit: cant upload pdfs, rtfs or docs¿ what type u want?
  • Replied 4 August 2017, 2:32 pm EST

    You should be able to detect the location of the max pages box before running the report store it in variables then pass that to your DrawText method post the run, merge and commit. Loop through all of your controls looking for the correct textbox settings if nothing else though a common textbox name across all your reports for the max pages textbox would simplify code.

    The only other option I can think of would be to make your reports subreports to a single parent that controls the pagecount functions, unfortunately that would be an "iffy" solution in my opinion without a static max pages location.

  • Replied 4 August 2017, 2:32 pm EST


    I am new to AR and i was searching for ways to merge multiple active reports into one pdf file and i came across this thread.

    The application i am working on creates these various reports and prints them as and when they are created (a few milli secs apart). These are not saved. Now, we need to add functionality to be able to mail them as an attachment (just one attachment - there can be any number of these reports for each run).

    I have got as far as saving these reports as seperate pdf files, but i havent been able to understand as to how to merge them. Could anybody help me a little more on the merging part?

    Or better yet, is it possible to keep appending the files as and when they are created to a file which can then be mailed as the attachment at the end of the application?

    I appreciate any help that is available.

    Thank you.
  • Replied 4 August 2017, 2:32 pm EST

    Why is the maxpages box moving? I had assumed it was in a PageHeader or PageFooter section, both of which should be static. If nothing else you may want to set the visibility of the maxpages box to False after you detect its location on the report that way it isn't displayed since you seem to be able to position your drawing text where you want it.
  • Replied 4 August 2017, 2:32 pm EST

    the idea is good, I tried this:
    I collected they heights of each section and added them together. After that, i located the box, added the sections to the section of the box + the height of the box in this sections.
    The problem is, when i make a section larger or smalller, the text isnt moving, but my drawed text is, cause the the height is growing or getting smaller. I'm not sure if u see the problem, if not I'll try to explain better.
  • Replied 4 August 2017, 2:32 pm EST

     the problem is, the user can define where the page and maxpage control should be. Probably I can read this out, but isnt there an easier answer?
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels