Optimize pdf file size using Ghostscript

| 1 Comment | No TrackBacks

We just got our conference booklet, and we need to publish it on the web. But, it has 152 Mb. This seemed excessive, so I googled a bit and found following:

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

$ ls -al input.pdf output.pdf 
-r-xr-xr-x 1 dpavlin dpavlin 158511430 May 11 16:23 input.pdf
-rw-r--r-- 1 dpavlin dpavlin   1646309 May 11 16:24 output.pdf
That's reduction to 1% of original size.

-dPDFSETTINGS=configuration to presets the "distiller parameters" to one of four predefined settings:

  • /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.

No TrackBacks

TrackBack URL: http://blog.rot13.org/mt/mt-tb.cgi/733

1 Comment

This command is working pretty good for PDF files that are big but don't have the layer complexity such as some "print-ready" magazine pdfs. I had similar need to convert a huge (120MB) pdf file into more optimized version. It had several layers of images and few of them contain alpha channels.. so whenever the 'gs' command parses this layers it crashes, showing the "/rangecheck in --.execform1--" error.. Anyway .. nice tip.

Leave a comment

About this Entry

This page contains a single entry by Dobrica Pavlinušić published on May 11, 2011 4:22 PM.

MojoFacets: ups! I created web spreadsheet with perl data mungling was the previous entry in this blog.

Kindle K3G and DXG is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

  • pics
OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.04