rnsanchez's hideout
…where every CPU cycle matters
.start
Academic
Publications
Projects
Contact
Recipes
››PostScript/PDF

Merging PostScript / PDF files

As usual, printers always run out of ink when you most need them. So, in order to get stuff printed, especially when it’s not my own printer, it must be on an appropriate format. In my case, the document must be a "contiguous" PostScript/PDF (larger-scale B&W laser printer at the University).

While fiddling with some PostScript tools to merge two simple files (one from OpenOffice, the other from XFig), I came across a post suggesting Ghostscript.

Having nothing to lose, I’ve tried, and it worked! My recipe is the following, in case you ever need it:

gs -dNOPAUSE -sPAPER=letter -sDEVICE=pdfwrite -sOutputFile=<outputfile.pdf> <input_files.{ps,pdf}> -c quit

Note that I’m setting paper size to letter, as I’m mixing different documents. This is just a failsafe. Also, note that as input you can throw PDF and PostScript files (even Encapsulated PostScript)--as long as Ghostscript is able to render it. The output is a nice PDF file in this case. Even page orientations are preserved.

Ghostscript has several output drivers, so it might suit your needs.

Again, I’m very happy to rely on these tools. Kudos to the Ghostscript developers!