Friday, August 10, 2007

Ghostscript

Most Linux users have Ghostscript, and Ghostscript is supposed to be
able to append PDFs. The way it works is that it "prints" the files in
sequence, but directs them to a loopback type of printer driver that
actually generates a new PDF. Here's the command:

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

Make appropriate substitutions for different paper sizes (apparently
nobody in North America has ever wanted to do this, because other
examples on the Web invariably specify A4 paper), filenames, etc. I've
found this technique to work quite well. Unfortunately, it caused
Ghostscript to die with a segfault on some of the input I wanted to run
it with, and nothing I could do would get it to process some of those files.

No comments: