Compressing PDF Files using MacOS or Linux
brew install ghostscriptgs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/screen -dCompatibilityLevel=1.4 -sOutputFile=output.pdf input.pdf# Usage: compresspdf [input file] [output file] [screen*|ebook|printer|prepress]
compresspdf() {
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1"
}compresspdf "Massive.pdf" "Small.pdf"Last updated