Created
May 6, 2013 20:23
-
-
Save shanecelis/5527887 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# shrinkpdf | |
# | |
# Shane Celis | |
if [ $# -ne 1 ] && [ $# -ne 2 ]; then | |
echo "usage: shrinkpdf <in.pdf> [out.pdf]" >&2; | |
echo "Shrink the size of the given PDF. By default it outputs to file 'out.pdf'." >&2; | |
exit 2; | |
fi | |
in="$1"; | |
out=out.pdf; | |
if [ $# -eq 2 ]; then | |
out="$2"; | |
fi | |
resolution=300; | |
gs -q -dNOPAUSE -dBATCH -dSAFER \ | |
-sDEVICE=pdfwrite \ | |
-dCompatibilityLevel=1.3 \ | |
-dPDFSETTINGS=/screen \ | |
-dEmbedAllFonts=true \ | |
-dSubsetFonts=true \ | |
-dColorImageDownsampleType=/Bicubic \ | |
-dColorImageResolution=$resolution \ | |
-dGrayImageDownsampleType=/Bicubic \ | |
-dGrayImageResolution=$resolution \ | |
-dMonoImageDownsampleType=/Bicubic \ | |
-dMonoImageResolution=$resolution \ | |
-sOutputFile="$out" \ | |
"$in" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment