Join PDF files

by Jane on November 18, 2009

This is a tip that sounds stupid, until you really need it.

Say you’re applying for a job, and have several PDF files:  a CV, a research statement, a cover letter.   Files are supposed to be emailed to an office assistant.   You can send separate files, but they may get confused, lost, only some get printed, etc.

Or, you can string the PDFs together into one file.  I tried doing this by dragging & dropping files into Preview and saving as a new file, or by using a shareware program.  Results included corrupted figures, and unintentional palimpsests (three pages of “page 1” overtyped on 1 page).  Then I learned the command of wonder:
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=joined.pdf  cover.pdf  CV.pdf research.pdf

One simple command, to join PDF files in their natural tongue of postscript.

PS — Does anyone know of a program that will verify a PDF file, by which I mean, will ensure that it’s readable on different platforms?  I’ve had cases of a PDF file displaying different on a linux machine than a PC, than a mac.

{ 9 comments… read them below or add one }

1 Wolfgang Kerzendorf November 18, 2009 at 7:55 pm

There’s a fatastic tool called pdfmerge4unix (pdfmerge for short) which is a little perl program that does that for you. It works without problems on Snow Leopard and Leopard.
The other thing that I discovered: matplotlib can do multi-page pdf files
from matplotlib.backends.backend_pdf import PdfPages
pdf=PdfPages(‘mypdffile.pdf’)
savefig(pdf,format=’pdf’)
#when done:
pdf.close()

These programs were very helpful, at least for me.

Reply

2 Marshall November 18, 2009 at 9:19 pm

I’ve used the command line options before, but now in Snow Leopard you can do this right in Preview. Just open up both PDF files and show the sidebar with the tiny thumbnail images of the pages, drag one set of thumbnails into the other PDF, and hit ‘save’. You can also delete pages from a PDF by deleting thumbnails, or copy some pages and create a new PDF from them. These improvements in Preview are one of my favorite things about Snow Leopard.

Reply

3 Jonathan Foster November 19, 2009 at 1:17 pm

Naturally your friend Convert can do this too:

convert piece1.pdf piece2.pdf Output.pdf

Another nice GUI option to manipulate/join multiple PDFs is the freeware program PDFLab

Reply

4 Kayhan November 23, 2009 at 9:39 am

I have been using gs for this as well, but I’ve found that my pdfbookmarks don’t work correctly afterwards. Has anyone else had this problem and/or fixed it?

Reply

5 Charon November 27, 2009 at 4:44 pm

You can also use pdfpages, e.g.:

\documentclass[letter]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=1-]{/path/file1.pdf}
\includepdf[pages=1-]{/path/file2.pdf}
\includepdf[pages=1-]{/path/file3.pdf}
\end{document}

Links in the files are lost when you do this, though.

Reply

6 Lisa December 2, 2009 at 11:51 am

Another option is to use Automator.

1) Finder: Get Selected Finder Items.
2) PDF: Combine PDF Pages
3) Finder: Open Finder Items

Reply

7 Henry December 14, 2009 at 3:31 pm

Awwww, man, I *had* to learn this the day after I needed. Oh well, lesson learned … thanks, everyone, for the tips.

Reply

8 Kelle December 22, 2009 at 4:28 pm

Regarding Preview in 10.6 and Marshall’s comment: I was having some trouble combining PDFs with this method and it turns out that you have to drag the new PDF on top of the thumbnail, not just to the sidebar. If you just add it to the sidebar, Preview think you want to display multiple PDFs in one window. More details here http://www.macosxhints.com/article.php?story=20090915223224601

Reply

9 Steve May 18, 2012 at 2:02 pm

pdftk can do this trivially on the command line (along with many other operations on PDFs).

Reply

Leave a Comment

Previous post:

Next post: