dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

pdfcompress (654B)


      1 #!/bin/sh
      2 if ! command -v gs 1>/dev/null 2>&1; then
      3   echo "ghostscript not installed." >&2
      4   exit 1
      5 fi
      6 [ $# -eq 2 ] || { echo "Arguments: infile, outfile"; exit 1; }
      7 
      8 while
      9   _i=0 _quality='' quality=''
     10   for _name in "/screen (lowest)" "/ebook" "/printer" "/prepress" "/default"; do echo "$((_i+=1))) $_name"; done
     11   printf '$# '; read -r _quality
     12 do
     13   case $_quality in 1) quality="/screen (lowest)";; 2) quality="/ebook";; 3) quality="/printer";; 4) quality="/prepress";; 5) quality="/default";; *) continue;; esac
     14   gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS="$quality" -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$2" "$1"
     15   break
     16 done