Concatenate PDFs

I often like to print out many web pages to read on the train.  To not waste paper I like to print them 2 up and double sided.  If the printer supports it, I also like to staple the pages.  On Linux, I use Firefox to print to postscript, then used a2ps to have the PS files combined, 2-uped, and short-side duplexed.  I’d then manually staple it, as there was no good way to tell the print center at work to staple it.  I’d use a command line similar to this:

a2ps -Eps -Afill -stumble 1.ps 2.ps 3.ps 4.ps

I tried this approach under OS X, but the problem is that the postscript that is generated on OS X is so detailed that it takes forever to process to print out, on the order of 2 minutes of processing per article.  Since PDF is the spooling format for printing in OS X (coming soon to linux) I thought I’d look to see if there was an easy way to concatinate PDF files so I could then have the regular printing interface (via Preview) handle the 2-up, double-sided, stapling goodness.

After much searching around I found this article and later this web page.  Combining a bit from both, I came up with following that works really well in my few days of testing.

texexec --pdf --paper=letter --pdfarrange --result all.pdf 1.pdf 2.pdf 3.pdf 4.pdf

It runs really quickly (especially in comparison to the a2ps method) and then I just open all.pdf and print from there.  It requires that you have teTeX installed.  On both Linux and OS X I had this installed as part of the prerequesets for docbook and doxygen.

2 thoughts on “Concatenate PDFs”

  1. I’ve been using pdftk for this for some time.  There is also Combine PDFs, which I haven’t used.  pdftk will also apply one PDF to another as a "background" or watermark image.  I’ve used this to underlay a form that lacks fill-ins with the PDF of the data laid out appropriately.

Leave a Reply