pdf-compress.sh (450B)
1 #!/bin/sh 2 3 if [[ $# -gt 0 ]]; then 4 5 for f in "$@"; do 6 echo "processing '$f'" 7 /usr/local/bin/gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \ 8 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH \ 9 -dDetectDuplicateImages \ 10 -dCompressFonts=true -r150 \ 11 -sOutputFile="${f%.*}_compressed.pdf" "$f"; 12 done 13 else 14 echo "Error: you must specify one or more input PDF files" 15 exit 1 16 fi