Menu
Menu

Optimizing pdf for size

Posted in linux on 2014/02/11
Tags: , , ,

Sometimes the pdf file seems to be really big and you would like to reduce its size, without loosing much quality. This can easily be done with ghostscript (http://www.ghostscript.com/doc/9.14/Ps2pdf.htm#Options). Take a look especially at the -dPDFSETTINGS  option:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
  • /default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.

Below the commands I've used to create different file from the sample file:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dBATCH -dQUIET -dNOPAUSE -dPDFSETTINGS=/screen -sOutputFile=sample_screen.pdf sample.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dBATCH -dQUIET -dNOPAUSE -dPDFSETTINGS=/ebook -sOutputFile=sample_ebook.pdf sample.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dBATCH -dQUIET -dNOPAUSE -dPDFSETTINGS=/printer -sOutputFile=sample_printer.pdf sample.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dBATCH -dQUIET -dNOPAUSE -dPDFSETTINGS=/prepress -sOutputFile=sample_prepress.pdf sample.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dBATCH -dQUIET -dNOPAUSE -dPDFSETTINGS=/default -sOutputFile=sample_default.pdf sample.pdf

Below you can see the sizes of the different versions:
21547    sample_prepress.pdf
21556    sample_ebook.pdf
21565    sample_default.pdf
21565    sample_screen.pdf
23742    sample_printer.pdf
32721    sample.pdf

Please note that it eventually  does not work for all pdf files, but it is worth to try different options, check the size and the quality of the new pdf file and eventually use it instead of the original one.

 

Comments are closed.