Skip to content

Instantly share code, notes, and snippets.

@slivero
Created September 22, 2011 09:38
Show Gist options
  • Save slivero/1234422 to your computer and use it in GitHub Desktop.
Save slivero/1234422 to your computer and use it in GitHub Desktop.
Compress a pdf file using ghostscript (Should work on any OS)
# Compresses a pdf file
# Compression level can be adjusted by changing -dPDFSETTINGS
# Possible values:
# -dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images)
# -dPDFSETTINGS=/ebook (low quality, 150 dpi images)
# -dPDFSETTINGS=/printer (high quality, 300 dpi images)
# -dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
# -dPDFSETTINGS=/default (almost identical to /screen)
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment