Making PDFs smaller with Ghostscript Thu, Jul 30, 2009

Often I find myself sending PDF documents around that have been generated from OS X using its print to PDF functionality or scanned in from the old HP all-in-one. Handy! Works great! Except for the fact that the files generated tend to be on the largish side.

To get around this I found some helpful commands for Ghostscript that can shrink said largish PDF down to a more reasonable size. To be honest I’m not sure of any negative side effects, but this has saved me on several occasions.

Here is the function I made in my .bash_proflie (no real error checking and only does one file at a time)

function shrinkpdf {
     mv "${1}" "${1}.tmp" && gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dPDFSETTINGS=/ebook -sOutputFile="${1}" "${1}.tmp" && rm "${1}.tmp"

Here is an example from a recently scanned document

Before shrinking 7.7M 8057822 Jul 14 15:45 sc0070af27.pdf

Then ran:

shrinkpdf sc0070af27.pdf

After shrinking 1.2M 1294394 Jul 30 07:15 sc0070af27.pdf

Saving some space! Not a big deal in the grand scheme of things, but helps when it is necessary to send multiple documents while staying below the 10M cap that many email servers still have as a limit. Could be improved greatly, but like many things it worked and that’s all it takes to GTD.

Newer and older stuff..

Some smiling faces Comments return