Inspirado em Max Glenister & Milan Kupcevic , Agradecimentos a Burgi, explicação do script de exemplo: Reduz o tamanho do PDF de Maciço para Pequeno usando ebook filtro
brew install ghostscript # aptitude work too if you do not have brew
compresspdf() {
echo 'Usage: compresspdf [input file] [output file] [screen|ebook|printer|prepress]'
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1"
}
compresspdf "Massive.pdf" "Small.pdf" ebook
Opções Gs:
-dPDFSETTINGS=/screen (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook (low quality, 150 dpi images)
-dPDFSETTINGS=/printer (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default (almost identical to /screen)