Autonomía digital y tecnológica

Código e ideas para una internet distribuida

Linkoteca. Shrinkpdf

Ghostscript is a great tool for compressing PDFs. In our tests it delivered the best compression ratio. Simply run:

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

-dPDFSETTINGS can be any of:
/screen : low-resolution output, lowest output size
/ebook : medium-resolution output, medium output size
/printer OR /prepress : high-resolution with maximum output size

Run the Shrinkpdf script:

./shrinkpdf in.pdf out.pdf

The script is almost same as the explicit gs command above. However, it has one advantage – it does an output file size check.