Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to programmatically "chain" several PDF files, preferably from command line?

Tags:

pdf

Is there a way, in Linux, Windows, or preferably Mac OS X to take a bunch of PDF files and "chain them" into one "booklet" without owning Acrobat and preferably without doing this manually?

I have TexShop, MikTex and the like installed, if any of their utilities help.

like image 855
Uri Avatar asked Jan 12 '09 02:01

Uri


2 Answers

ghostcript method:

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

from: How to concatenate PDFs without pain

ImageMagick method:

convert file1.pdf file2.pdf file3.pdf out.pdf

pdftk method:

pdftk file1.pdf file2.pdf file3.pdf cat output out.pdf
like image 118
Luis Melgratti Avatar answered Nov 09 '22 09:11

Luis Melgratti


I have tried several different tools and have gotten the most reliable results with the PDF toolkit, pdftk. It seems to work more consistently than trying to use gs or messing around with conversion to PostScript and back. And it avoids dealing with one image per page, which is a nuisance.

pdftk is included in Debian-based Linux distributions and perhaps others as well.

like image 39
Norman Ramsey Avatar answered Nov 09 '22 11:11

Norman Ramsey