Skip to content

Instantly share code, notes, and snippets.

@zmilonas
Last active June 25, 2020 17:06
Show Gist options
  • Save zmilonas/1a88aa83412b80f1106265c1d0a6a038 to your computer and use it in GitHub Desktop.
Save zmilonas/1a88aa83412b80f1106265c1d0a6a038 to your computer and use it in GitHub Desktop.
GhostScript command to compress large PDFs with a lot of images. Requirements: https://www.ghostscript.com. Usage: `./compress.sh <input file> <output filename sans pdf>
#!/bin/sh
gs \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dEmbedAllFonts=true \
-dSubsetFonts=false \
-dNOPAUSE \
-dQUIET \
-dBATCH \
-sOutputFile=$2.pdf \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment