Skip to content

Instantly share code, notes, and snippets.

@niketpathak
Last active March 12, 2021 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niketpathak/fac38bdc5d37c87157681c5571713769 to your computer and use it in GitHub Desktop.
Save niketpathak/fac38bdc5d37c87157681c5571713769 to your computer and use it in GitHub Desktop.
Compress Pdf in Ubuntu
# Use the following ghostscript command:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=/home/niketpathak/Downloads/output.pdf /home/niketpathak/Downloads/input.pdf
# Summary of -dPDFSETTINGS:
# -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
# -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs. (150 dpi)
# -dPDFSETTINGS=/prepress output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi)
# -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi)
# -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file
# src: https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment