Merge adobe acrobat files automatically

Posted on 2011-10-21
Last Modified: 2013-06-13
Hello Experts!

I've seen a couple of quesitons on merging PDF files but have not seen an answer that addresses my scenario (have I missed something?).

I need to automatically merge a series of pdf files into a single acrobat file in a particular sequence specifed by the boss. The sequence will change as new reports are added or old ones are removed.  

I have around 24 report files total right right now that I have to merge manually in a partcular sequence every week sometime many, many times in a week with new versions of the reports.  

Prefer if this can be done using VB Script or VBA simply because I have worked with those and know how to call or integrate from MS Access 2003 as part of a report macro or code module.  However I believe I read that the Adobe API uses Java so whatever gets the job done, I just may need a few pointers to get another language to work.

I have Acrobat Pro 9 installed on my PC.

Thanks for any help!
Question by:matttclark
    LVL 32

    Expert Comment

    by:Robberbaron (robr)
    i would be using the pdftk commandline app  because i know how to script it via commandline parameters from vba etc

    Author Comment

    I can install that if you give me the script! thanks
    LVL 44

    Expert Comment

    Do the file names provide you with enough information to properly sequence the PDFs for the concatenation process?

    Author Comment


    not about a sample?

    1.      Adonis SPP
    2.      Adonis SPP summary
    3.      HTC SPP
    4.      HTC SPP Summary
    5.      Belkin SPP
    6.      Belkin SPP Summary
    7.      Notes and Changes
    8.      Cover
    9.      TOC
    10.      Division 1000 Summary
    11.      Division 1100 Summary
    12.      Division 1200 Summary
    13.      FS Managers summary
    14.      FS All customers
    15.      FS By code

    Sequence is manually set and with this sampling is 8, 9, 7, 10, 11, 12, 5, 6, 1, 2, 3, 4, …etc

    LVL 44

    Accepted Solution

    I'm using PDFSAM (1.1) for this test.

    I created a file named MergeList.csv in my test directory with the following contents:
    D:\MergeQuestion\Notes and Changes.PDF
    D:\MergeQuestion\Division 1000 Summary.PDF
    D:\MergeQuestion\Division 1100 Summary.PDF
    D:\MergeQuestion\Division 1200 Summary.PDF
    D:\MergeQuestion\Belkin SPP.PDF
    D:\MergeQuestion\Belkin SPP Summary.PDF
    D:\MergeQuestion\Adonis SPP.PDF
    D:\MergeQuestion\Adonis SPP summary.PDF
    D:\MergeQuestion\HTC SPP.PDF
    D:\MergeQuestion\HTC SPP Summary.PDF
    D:\MergeQuestion\FS Managers summary.PDF
    D:\MergeQuestion\FS All customers.PDF
    D:\MergeQuestion\FS By code.PDF

    Open in new window

    I had a single blank page PDF that I copied and renamed to the documents you listed in the order you prescribed.

    I placed the following in a batch file named RunMerge.cmd
    cd \pdfsam\bin
    run-console -l "D:\mergequestion\mergelist.csv" -o "D:\mergequestion\mergeddocument.pdf" concat

    Open in new window

    When I run the batch file, all the pages are merged into mergeddocument.pdf

    Note: the pause in the batch file allows me to inspect the log for errors.

    Author Comment

    aikimark-wow thanks for the effort.

    was not familiar with PDF SAM but googled it and am reading up on.  will download and install on work PC on Monday and run through your bat file!

    let me get back to you then, have a good rest of the weekend! thanks again.
    LVL 32

    Expert Comment

    by:Robberbaron (robr)
    I too was not aware of PDF-SAM.
    While PDFTL will do the job, given the number of fields you wish to merge the PDF_SAM ability to read input from a CSV file is a big advantage.
    And means the batchfile is independent of the input.

    Author Closing Comment

    sorry for the delay. won't be able to get this installed on Office PC for a week or two (corporate IT), but based on everything I've read, this shoudl do the trick.

    thanks again!

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This article will show, step by step, how to integrate R code into a R Sweave document
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now