Created
April 23, 2021 08:40
-
-
Save rbnvrw/a047887fbc0a9da808826ac74fb749bc to your computer and use it in GitHub Desktop.
Compress PDF using ghostscript for online publication of a large book (e.g. a PhD thesis)
This file contains 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
#!/bin/bash | |
# input file | |
INFILE=thesis.pdf | |
# output file | |
OUTFILE=thesis_compressed.pdf | |
# /printer compresses to ~300 DPI, various optimizations | |
# -dPrinted=false preserves PDF hyperlinks | |
# Other properties set the resolution of the images to 200DPI, which is too small for printing but good enough for showing on a screen | |
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -dPrinted=false -dDetectDuplicateImages -dDownsampleColorImages=true -dDownsampleGrayImages=true -dDownsampleMonoImages=true -dGrayImageResolution=200 -dColorImageResolution=200 -dMonoImageResolution=400 -sOutputFile="${OUTFILE}" "${INFILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment