Skip to content

Instantly share code, notes, and snippets.

@ckunte
Last active June 4, 2018 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckunte/822e28d3661cb4fb03be2c298965f1ad to your computer and use it in GitHub Desktop.
Save ckunte/822e28d3661cb4fb03be2c298965f1ad to your computer and use it in GitHub Desktop.
Compressing pdf files with ghostscript. (The ebook option, I think, offers the best compression without loss of quality.)
#!/usr/bin/env bash
# -*- coding: UTF-8 -*-
# compress all pdf files in a folder -- 2018 ckunte
for i in *.pdf; do gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compr_$i $i; done
#!/usr/bin/env sh
# ref: https://tex.stackexchange.com/questions/142455/xetex-xdvipdfmx-option-to-reduce-all-graphics-to-300dpi
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=file-compressed.pdf file.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment