Last active
March 31, 2022 11:39
-
-
Save izikeros/6dfb6a78f2559678163e5dc0b49760fa to your computer and use it in GitHub Desktop.
Reduce size of pdf file using GhostScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Requires ghostscript installed. | |
| # - On MacOSX: brew install ghostscript | |
| # - On Windows: install binaries via https://www.ghostscript.com/ | |
| # | |
| # use PDFSETTINGS: '/default','/prepress','/printer','/ebook','/screen' | |
| # 0: default - almost identical to /screen | |
| # 1: prepress - high quality, color preserving, 300 dpi imgs | |
| # 2: printer - high quality, 300 dpi images | |
| # 3: ebook - low quality, 150 dpi images | |
| # 4: screen - screen-view-only quality, 72 dpi images | |
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS='/screen' -dNOPAUSE -dQUITET -dBATCH -sOutputFile="output.pdf" input.pdf | |
| See python wrapper: https://github.com/theeko74/pdfc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment