2

I have one standard file (call it ending.pdf) that I want added to the end of all of the PDFs in a folder. Can I automate this task? I have Acrobat Pro X. Thanks in advance for any suggestions.

Oh, I forgot to mention I'm using Windows 7.

Karan
  • 55,947
  • 20
  • 119
  • 191
Josh
  • 23
  • 1
  • 4
  • 1
    Which operating system are you using? – Flimzy Jun 05 '13 at 20:55
  • 1
    What OS are you using? If it's something unixy, you can use imagemagick, namely the convert command. – SBI Jun 05 '13 at 20:56
  • @SBI imagemagick "runs on Linux, Windows, Mac Os X, iOS, Android OS, and others." – terdon Jun 05 '13 at 21:00
  • I know, but depending on what you run, installing and using it is straight forward...or not ;) – SBI Jun 05 '13 at 21:00
  • 1
    Assuming Windows as platform, you could use the PDF Toolkit PDFtk: http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ Just loop through your existing files using a CMD command file using a "for /F" construct. Take special care for encrypted/protected/compressed files. – Axel Kemper Jun 05 '13 at 21:58
  • Oops! Forgot to mention I'm on Windows 7. So when you say 'Just loop through your existing files using a CMD command file using a "for /F" construct', can you give me an example of that? Maybe I'm not smart enough to use SuperUser! Thanks. – Josh Jun 05 '13 at 22:07

1 Answers1

2
  1. Download and install PDFtk.

  2. Copy Ending.pdf to one directory (say C:\End) and all the other PDFs to another directory.

  3. At the command prompt type pdftk and press Enter. If you receive an error like 'pdftk' is not recognized as an internal or external command, operable program or batch file, you'll need to add the PDFtk installation directory to your PATH or specify the full path to pdftk.exe in the command below.

    Alternatively, since the app is pretty much portable and I don't see any registry keys or miscellaneous files being created/littered about the system, you can simply copy pdftk.exe from the installation directory to the directory where your PDFs reside.

  4. At the command prompt run the following command in the directory with the PDFs you want to append Ending.pdf to:

     for %a in (*.pdf) do pdftk "%~a" "C:\End\Ending.pdf" cat output "%~na (Joined)%~xa"
    
Karan
  • 55,947
  • 20
  • 119
  • 191
  • Hey Karan, thank you so much! This works great. I just have one follow-up question. How can I make them have the same file name as the original, rather than with (Joined) at the end? I tried just removing that bit in the code, but it gives an error that the input file name matches the output file name. Perhaps having them deposited into a subfolder or something? – Josh Jun 06 '13 at 18:08
  • Yeah, you can try something like `... cat output "C:\MyPDFs\%~a"` and you should hopefully end up with new files but with their original names in `C:\MyPDFs`. – Karan Jun 06 '13 at 18:30