Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active March 27, 2024 15:18
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 plembo/0282c4fb831be7ce4203c315b5c84ea1 to your computer and use it in GitHub Desktop.
Save plembo/0282c4fb831be7ce4203c315b5c84ea1 to your computer and use it in GitHub Desktop.
Massively shrink PDF size

Massively shrink the size of a PDF file

Use ghostscript:

$ gs -sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE \
-dBATCH \
-dColorImageResolution=150 \
-sOutputFile=gutter.pdf GutterMagic.pdf

Or use the ghostscript utilities for PDFs:

$ pdf2ps -dLanguageLevel=3 GutterMagic.pdf
$ ps2pdf -dPDFSETTINGS=/ebook -sOutputFile=gutter.pdf GutterMagic.ps

REFERENCES

Greg Pittman. "Shrink PDF size with this command line trick". opensource.com, 18 August 2020, https://opensource.com/article/20/8/reduce-pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment