Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

command-line way to combine PDFs?

Every day, I have a new directory of PDF files which need to be combined into a single multi-page pdf document for that day. At 4am. Unfortunately, every instruction I can find for combining files starts out with "click on the files... drag... drop..." but I don't want to have to get up at 4am to click and move!


Is there a command-line command which I can put into a perl script that will do the combining?

Posted on Nov 14, 2012 11:06 AM

Reply
Question marked as Best reply

Posted on Nov 14, 2012 11:24 AM

The question isn't the command to combine the pdf's Automator has a combine PDF's command, it's how do you know what pdf's there are and where they are located.


Once you can answer that coming up with an automated way to do it shouldn't be to hard.

8 replies

Nov 14, 2012 12:23 PM in response to Frank Caggiano

I have pretty much complete control over the files in question -- each one has a date embedded in its name, and I run through a couple of directories collecting copies of the files that match the date and I cp them into a folder with the date as its name. So, for example, today's directory is named

11142012

and the files

XYZ_11142012_X_0n.pdf


Any sort of random shell commands that I need to run -- cp, mkdir, find -name, etc. -- I can run inside my perl script(s) as pre-processing and/or post-processing.


edited to add that I've never used the Automator, and just now learned that there is an app in my Applications folder named "Automator"!

Nov 14, 2012 5:48 PM in response to cathy fasano

Let's assume the files "PDF 1.pdf" and "PDF 2.pdf" are contained in the folder "My folder" on the Desktop. Then, the following command, typed into the Terminal window, will merge those two files into one new file called "Merged PDF.pdf" also on the Desktop:


"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o "/Users/user name/Desktop/Merged PDF.pdf" "/Users/user name/Desktop/My folder/PDF 1.pdf" "/Users/user name/Desktop/My folder/PDF 2.pdf"


See this web page.

command-line way to combine PDFs?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.