Terry : Processing PDF

Processing PDF


  • Linux (gs command line tool,¬†built-in)
  • Mac
    Install Ghostscript via MacPorts, Homebrew, or just use the Preview.app GUI to drag & drop, save.
  • Windows
    Open Source - PDF Creator bundled

Optimize PDF

reduce file size for transferring

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Combine multiple PDF files

Merge multiple PDF files into 1

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -SOutputFile=combined.pdf 1.pdf 2.pdf

Extract pages from a PDF file

Extract pages from a PDF file

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
       -dFirstPage=10 -dLastPage=12 \
       -sOutputFile=outfile_p10-p12.pdf 100p-inputfile.pdf

Delete certain pages of a PDF document

Delete from PDF file

gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=m -dLastPage=n -sOutputFile=output.pdf input.pdf

where m and n are positive integers (page numbers),  for example the above command only prints out pages starting from page number m through n of input.pdf into output.pdf.

Recommended Viewers


evince (GNOME)

zathura (Command Line Interface)


Foxit Reader (Windows and Linux)

Mac OS X

Mac (Preview.app)

Adobe Reader for Linux is crap, NOT recommended.

Cross Platform (Browser built-in)

pdf.js for Firefox if you don't want a client installed.

Chrome PDF Viewer (enable it in chrome://plugins)