minimize-pdf-file-size 379 B

12345678910111213141516171819
  1. #!/bin/sh
  2. if [ "$#" -lt "2" ]; then
  3. APPNAME=$(basename $0)
  4. echo "USAGE: $APPNAME [input pdf] [output pdf]"
  5. exit 1
  6. fi
  7. IN=$1
  8. OUT=$2
  9. echo "Optimizing $IN for screen resolution, and saving to $OUT."
  10. gs -o $OUT \
  11. -dNOPAUSE \
  12. -sDEVICE=pdfwrite \
  13. -dCompatibilityLevel=1.4 \
  14. -dPDFSETTINGS=/screen \
  15. $IN