Skip to content

Instantly share code, notes, and snippets.

@Ortham
Created August 6, 2017 12:50
Show Gist options
  • Save Ortham/b51264a8e833c5c4bb9e0501d0220798 to your computer and use it in GitHub Desktop.
Save Ortham/b51264a8e833c5c4bb9e0501d0220798 to your computer and use it in GitHub Desktop.
A script for slimming PDFs (eg. of scanned documents)
ls -1 *.pdf | (IFS=: ; while read FILENAME; do s=${FILENAME##*/} ; gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=${s%.pdf}.2.pdf ${FILENAME} && mv ${s%.pdf}.2.pdf ${FILENAME} ; done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment