AO-pdf-shrink 758 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # AO-pdf-shrink
  3. # GPLv3+
  4. #
  5. # Usage:
  6. # AO-pdf-shrink foo.pdf
  7. # Set QUALITY to one of the below:
  8. # screen -- lower quality, smaller size.
  9. # ebook -- for better quality, but slightly larger pdfs.
  10. # prepress -- output similar to Acrobat Distiller "Prepress Optimized" setting
  11. # printer -- selects output similar to the Acrobat Distiller "Print Optimized" setting
  12. # default -- selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file
  13. QUALITY=screen
  14. OUTPDF="`basename $1 .pdf`-$QUALITY.pdf"
  15. gs \
  16. -sDEVICE=pdfwrite \
  17. -dCompatibilityLevel=1.4 \
  18. -dPDFSETTINGS=/$QUALITY \
  19. -dNOPAUSE \
  20. -dQUIET \
  21. -dBATCH \
  22. -sOutputFile=$OUTPDF \
  23. $1