Compress PDF

Article by on April 3, 2012, last modified on October 31, 2013

The most customizable and effective option I found was Option 4 with ImageMagick.

Option 1: pdftk

$ pdftk input.pdf output output.pdf compress

Option 2: pdf2ps->ps2pdf

$ pdf2ps input.pdf
$ ps2pdf output.pdf

Option 3: Mac's Preview With Quartz Filter

Open the PDF and click File->Save As and select "Reduce File Size" under "Quartz Filter".

You can add other quartz filters using the "ColorSync Utility":

Option 4: ghostscript

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

Option 5: convert (ImageMagick)

$ convert -compress JPEG -quality 100 -density 100x100 input.pdf output.pdf

You can tweak compression by changing the quality lower (more compressed) or higher (less compressed) and the density lower (more compressed) or higher (less compressed).

Some other options:

Older Articles »