Skip to content

Instantly share code, notes, and snippets.

@smhr
Created April 8, 2018 12:11
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 smhr/634d8764ef6deac711a417133e17d9c5 to your computer and use it in GitHub Desktop.
Save smhr/634d8764ef6deac711a417133e17d9c5 to your computer and use it in GitHub Desktop.
Reduce the size of pdf files in the current directory.
mkdir ./big_pdfs
mkdir ./small_pdfs
for F in `ls *.pdf`; do
echo $F
smallPDF="./small_pdfs/$F"
echo $newPDF
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=$smallPDF $F
done
# /screen – Lowest quality, lowest size
# /ebook – Moderate quality
# /printer – Good quality
# /prepress – Best quality, highest size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment