Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Combine PDFs without using Automator System 10.4
Tiger only hintThere have been many hints here about combining PDFs over the years. All but one required either third party software, or old versions of OS X. The most recent hint notes that Automator has a combine PDF action built-in. This is great, of course, if you're using Automator. But what if you want to combine PDFs in an AppleScript, or from the Terminal? How come Automator gets to have all the fun?

Well, if you crack open the Combine PDF action bundle, Automator's PDF combining secrets are laid bare: a Python script! Not just that, but a Python script with usage info:
join [--output <file>] [--append] [--shuffle] [--preview] [--verbose]
And here is how it might be used:

$ python '/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py' -o '/path/to/output.pdf' '/path/to/input1.pdf' '/path/to/input2.pdf'

Where /path/to/input1.pdf and /path/to/input2.pdf are the PDF files to be combined, and /path/to/output.pdf is the new combined PDF. /path/to Shell and AppleScript programmers should have little trouble finding use for a ready-made PDF combining service that exists on every standard OS install. I've already rolled it into a neat folder action AppleScript that you can find here.

[robg adds: If you're going to use this yourself often, you should probably create a soft link to the location, or maybe just copy it out to your own bin directory.]
    •    
  • Currently 3.89 / 5
  You rated: 1 / 5 (9 votes cast)
 
[75,442 views]  

10.4: Combine PDFs without using Automator | 12 comments | Create New Account
Click here to return to the '10.4: Combine PDFs without using Automator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Combine PDFs without using Automator
Authored by: tatilsever on Mar 31, '06 09:40:29AM

I thought this hint accomplished the "one line Terminal" command requirement already:

http://www.macosxhints.com/article.php?story=2003083122212228

Tiger does come with GhostScript installed by default, does it not? Of course, knowing more than one way to do a task never hurts, so thanks...



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: ever on Mar 31, '06 10:02:39AM

Nope. This is the only script that works off the shelf.



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: Schwie on Mar 31, '06 11:59:24AM

If you like or really need the command line, this hint works. For the rest of us, check out Combine PDF:

http://www.monkeybreadsoftware.de/Freeware/CombinePDFs.shtml

I've used it for a few years and its been great for me.



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: magnamous on Mar 31, '06 01:07:02PM

If I recall correctly, "Combine PDFs" downsamples PDF files. I had a couple of PDFs at 300 dpi that I wanted to combine, and when I opened the resulting file, it was blurry when I zoomed in. I did a Get Info in Preview and found that the image had been downsampled to 72 dpi. I believe that's why I stopped using it.

The Automator action might do the same thing, but I don't remember for sure. It's been a long time since I combined high-resolution PDFs.



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: Welles Goodrich on Apr 02, '06 09:34:08AM

Last week I used CombinePDFs 2.1 for scanned legal documents which needed to be possibly printed at a later date from a CD submission as part of a franchise renewal package. I saved the original documents in Photoshop as TIFF files, used the Print dialog save to PDF rather than the Photoshop PDF format as it was less than half the file size. Then I combined them using CombinePDFs 2.1 without any change in the basic files sizes, and finally ran the files through PDF Shrink at a High Quality Print setting to drop the file size by about 30 -40%. Zooming in 800% in Acrobat reader showed a crisp image which printed as well as the original scans.



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: barijaona on Mar 31, '06 05:47:34PM

I'd rather recommand PDFLab as a GUI tool :

http://www.iconus.ch/fabien/pdflab/



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: hschickel on Mar 31, '06 01:53:13PM

pdftk

http://www.accesspdf.com/pdftk/

Can be installed in many ways including via DarwinPorts. This tool is perfect for batch processing PDFs via scripts.

From the man page...

DESCRIPTION
If PDF is electronic paper, then pdftk is an electronic
staple-remover, hole-punch, binder, secret-decoder-ring,
and X-Ray-glasses. Pdftk is a simple tool for doing
everyday things with PDF documents. Use it to:

* Merge PDF Documents
* Split PDF Pages into a New Document
* Decrypt Input as Necessary (Password Required)
* Encrypt Output as Desired
* Fill PDF Forms with FDF Data and/or Flatten Forms
* Apply a Background Watermark
* Report PDF Metrics such as Metadata and Bookmarks
* Update PDF Metadata
* Attach Files to PDF Pages or the PDF Document
* Unpack PDF Attachments
* Burst a PDF Document into Single Pages
* Uncompress and Re-Compress Page Streams
* Repair Corrupted PDF (Where Possible)



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: ob1cannoli on Mar 31, '06 03:26:25PM

the beauty of this hint, however, is that it comes on the out-of-the-box Tiger install. There are plenty of ways to combine PDFs, but if you want to ensure applescripts work without additional installs, this seems like the way to go.



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: luomat on Dec 12, '06 10:20:21PM

The original hint doesn't work for me on 10.4.8 on my MacBook: Traceback (most recent call last): File "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py", line 23, in <module> from CoreGraphics import * ImportError: No module named CoreGraphics



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: plindberg on May 31, '07 02:22:47AM

Chances are you have installed Python via for instance DarwinPorts. Apparently the CoreGraphics binding for python is in someway linked to the python binary that ships with Tiger. Invoking python via its explicit path might do the trick, try "/usr/bin/python ..." (followed by the rest of the arguments).



[ Reply to This | # ]
10.4: Combine PDFs without using Automator
Authored by: alec kinnear on Nov 03, '07 02:50:20PM
I second the recommendation for PDF Lab. Simple clean no-nonsense. Got the job done under deadline with PDF's from 4 different sources.

I donated ($20).

---
WordPress SEO Secrets - foliovision.com/weblog

[ Reply to This | # ]

10.4: Combine PDFs without using Automator
Authored by: smccandlish on Aug 05, '11 09:58:21PM

Just FYI, this method is far superior to the GhostScript-based commandline in another hint, as GS reduces the quality drastically, even to the point of making small text unreadable after the file merge.

To use THIS hint's code in an easy shell script, try:

python '/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py' -o 'output.pdf' "$@"
all on one line, with "output.pdf" being whatever you want as the default output filename. The "$@" will accept any legal filename/wildcard mess, like "file\ 1.pdf 'file 2.pdf' " or "*.pdf" or "file0?.pdf" or whatever.

---
Stanton McCandlish
Principal, McCandlish Consulting


[ Reply to This | # ]