Compressing PDFs

Following Thomas’ advice I just added this to my .bash_profile:

compresspdf() {
  tmpfile=$(mktemp /tmp/compresspdf.XXXXXX)
  cp -p "$1" $tmpfile
  gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -sOutputFile="$tmpfile" "$1"
  mv -f $tmpfile "$1"
}

Just invoke it with: compresspdf filename

Read more...