Unconfigured Ad Widget



No announcement yet.

Merge pdf documents

  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge pdf documents

    Not sure if this is the right forum but here it goes...

    We have a batch process that in the end, creates pdf's on the ifs. Is there a utility that could merge 2 pdf's into 1 on the ifs? e.g.

    I would like to be able to merge the 2 CUST001 pdf's into 1 in a batch program. Any ideas how this might be accomplished or is it possible.


  • #2
    Look for the "TechTip: More iSeries PDF Wizardry" thread under Document Management in the forums and locate the code link there. The CONCATPDF command that Giuseppe Costagliola created will do exactly what you need. I just went through this and it works great.


    • #3
      This could also be accomplished with the use of the iText open source project with a few lines of code.

      In Java, this would be some simplistic code to do the job:

      import java.io.*;
      import com.lowagie.text.*;
      import com.lowagie.text.pdf.PdfCopy;
      import com.lowagie.text.pdf.PdfReader;
      public class PdfMerge
        public static void main ( String[] args )
          String[] fileArray = {"C:\\pdf1.pdf", "C:\\pdf2.pdf"};
           Document out = new Document();
           PdfCopy copy = new PdfCopy(out, new FileOutputStream("C:\\pdfOut.pdf"));
           for (String s: fileArray)
               PdfReader reader = new PdfReader(s);
               for (int i = 1; i <= reader.getNumberOfPages(); i++)
                 copy.addPage(copy.getImportedPage(reader, i));
           catch (Exception ex)
             // Put Exception Handling here

      And you could easily wrap some RPG prototypes and procedures around this and call it right from an RPG program.

      My book Advanced Integrated RPG has a few chapters on working with PDF files from RPG. If you're working with PDFs on the IBM i, you would find this book helpful.
      Last edited by T.Snyder; 05-11-2010, 06:48 PM. Reason: HTML Formatting


      • #4

        Thank you for the replies. I did see the "TechTip: More iSeries PDF Wizardry" before posting but from where I accessed it from, the download code link did not work. I did find it here: http://www.mcpressonline.com/forums#...s-PDF-Wizardry

        D, Tom and Sebbastian, Thanks again.


        • #5
          One quick heads up--whether you use Tom's code above or the PDF Wizardry stuff, don't grab the latest iText jar file--use the iText-1.3.6.jar, which is on SourceForge.net. The class containers and some other features have changed, so this one will work without tweaking the code. Doug


          • #6
            Thanks for the heads up!


            • #7
              If you have a need to merge PDF documents we have a Native iSeries PDF and TIFF utility product for doing automated document assembly of PDF documents for archival and printing. PDF printing can be automated as well.

              Feel free to contact me directly or check out our web site.

              Richard Schoen
              RJS Software Systems Inc.
              Where Information Meets Innovation
              Document Management, Workflow, Report Delivery, Forms and Business Intelligence
              Email: richard@rjssoftware.com
              Web Site: http://www.rjssoftware.com
              Tel: (952) 736-5800
              Fax: (952) 736-5801
              Toll Free: (888) RJSSOFT


              • #8
                If you have a need to merge PDF documents we have a Native iSeries PDF and TIFF utility product for doing automated document assembly of PDF documents for archival and printing. PDF printing can be automated as well.
                Last edited by D.Uptmor; 07-16-2010, 05:40 PM.


                • #9
                  #step 1
                  Open all the .pdf files you wish to merge. These can be minimized on your desktop as individual tabs.
                  #Step 2
                  Pull up what you wish to be the first page of your merged document.
                  #Step 3
                  Click the 'Combine Files' icon on the top left portion of the screen.
                  #Step 4
                  The 'Combine Files' window that pops up is divided into three sections. The first section is titled, 'Choose the files you wish to combine'. Select the 'Add Open Files' option.
                  #Step 5
                  Select the other open .pdf documents on your desktop when prompted.
                  #Step 6
                  Rearrange the documents as you wish in the second window, titled, 'Arrange the files in the order you want them to appear in the new PDF'
                  #Step 7
                  The final window, titled, 'Choose a file size and conversion setting' allows you to control the size of your merged PDF document. Consider the purpose of your new document. If its to be sent as an e-mail attachment, use a low size setting. If the PDF contains images or is to be used for presentation, choose a high setting. When finished, select 'Next'.
                  #Step 8
                  A final choice: choose between either a single PDF document, or a PDF package, which comes with the option of creating a specialized cover sheet. When finished, hit 'Create', and save to your preferred location.
                  Last edited by D.Uptmor; 07-16-2010, 05:40 PM.


                  • #10
                    Merging PDF Files with Sonic PDF Creator 2.0

                    It may seem like you're in for a lot of pasting and editing, but it's really quite simple. Simple with Sonic PDF Creator 2.0, that is. In addition to creating PDF documents, our software also allows you to customize and create a merged PDF. No special tool is needed, no extra plug-ins required.

                    You can merge multiple PDFs into a single PDF by opening the PDFs to be merged and then clicking on the Merge PDF Files command option. Then, just select the PDFs to be merged and confirm by clicking on OK. It's that simple.

                    If you're creating a merged PDF with content from different file formats, you can use Sonic PDF Creator 2.0 to convert those files into PDF documents first and then combine them together. You don't even need to leave the application. Sonic PDF Creator 2.0 has the technology to accommodate various PDF needs.

                    A merged PDF, however, doesn't mean a static PDF document. The same PDF creation options are available to you as well, so you get that merged PDF exactly the way you want it.

                    * Delete or insert pages at specific points in the document.
                    * Preserve images, links and layouts of other PDF files.
                    * Add new bookmarks and attachments according to the new PDF structure.
                    * Set extra viewing and securing features.
                    * Rotate, crop and overlap pages

                    With the functions and features of Sonic PDF Creator 2.0, you get versatility. Our software lets you work with those PDF files efficiently and productively, giving work strategies that you can count on!
                    Last edited by K.Stuart; 07-20-2010, 02:41 PM.