Join PDF files

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… add one
  • Wolfgang Kerzendorf Nov 18, 2009 @ 19:55

    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.

  • Marshall Nov 18, 2009 @ 21:19

    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.

  • Jonathan Foster Nov 19, 2009 @ 13:17

    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

  • Kayhan Nov 23, 2009 @ 9:39

    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?

  • Charon Nov 27, 2009 @ 16:44

    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.

  • Lisa Dec 2, 2009 @ 11:51

    Another option is to use Automator.

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

  • Henry Dec 14, 2009 @ 15:31

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

  • Kelle Dec 22, 2009 @ 16:28

    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

  • Steve May 18, 2012 @ 14:02

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

Leave a Reply

Your email address will not be published. Required fields are marked *