#!/bin/bash # PDF Compressor # Dependencies: ghostscript # Note to self: "prepress" can also be "ebook" if [[ -e $1 ]]; then gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${1}_compressed.pdf" "$1" && printf "done" || printf "error" fi