Manipulate PDFs with gostscript

By | June 28, 2015

Basic Usage
Convert PostScript to PDF:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=fileout.pdf

Merge/combine PDF and/or PostScript files:

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=fileout.pdf \ filein2.pdf

Extract a page from a PostScript or a PDF document:

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=3 \

Additional Options
PDF optimization level selection options

-dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook (low quality, 150 dpi images)
-dPDFSETTINGS=/printer (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default (almost identical to /screen)

Paper size selection options

-dFIXEDMEDIA (force paper size over the PostScript defined size)

Other options

-r1200 (resolution for pattern fills and fonts converted to bitmaps)