Concatenate (Add Together) PDF Files in Linux

Some time last week, I found myself forced to use an obnoxious scanner that emailed individual scans to me as PDFs. I had to re-enter my email address on the impossible touch-screen keyboard for each page, and when I was done I had 7 emails in my inbox.

I needed to re-assemble these 1-page PDFs into a 7-page one. A quick google search led me to this page. But I’ll spare you the unnecessary list of non-solutions (as well as the hentai Site Traffic Strip-O-Meter). The real gem on that page is this linux command:

gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf

simply “cd” into the dir with all the pdfs that you want to string together, replace in1.pdf in2.pdf in3.pdf with the names of your pdf images, and voila! out.pdf is your new SuperPDF. The Eurasia of PDFs.

(This is the first time that I’ve posted a nerdy linuxey howto. This may or may not become a trend. But don’t get scared–the main focus of this blog will continue to be my crappy creations and stupid ideas.)

Comments (1)

butubotSeptember 17th, 2009 at 5:32 am

pdftk does a better job in my opinion. The output pdf of the gs command cannot be searched. there might be a switch that can be included in the gs command to allow this (who knows?).

The pdftk command is simpler, too

pdftk *.pdf cat output MyOutput.pdf

Just make sure that the input pdf files are named in sequence (alphabetically or numerically) so they show up in the output file in order.

One good thing about Linux is that you have a lot of choices to accomplish this particular task — and they’re all free.

Leave a comment

Your comment