Skip to content

Instantly share code, notes, and snippets.

@johnjohndoe
Last active December 10, 2015 00:49
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 johnjohndoe/4354025 to your computer and use it in GitHub Desktop.
Save johnjohndoe/4354025 to your computer and use it in GitHub Desktop.
Shell script to shrink the size of PDF using ghostscript.
#!/bin/sh
#
# Source: http://www.alfredklomp.com/programming/shrinkpdf/
gs -q -dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.3 \
-dPDFSETTINGS=/screen \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
-dColorImageDownsampleType=/Bicubic \
-dColorImageResolution=72 \
-dGrayImageDownsampleType=/Bicubic \
-dGrayImageResolution=72 \
-dMonoImageDownsampleType=/Bicubic \
-dMonoImageResolution=72 \
-sOutputFile=$1_72dpi.pdf \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment