Skip to content

Instantly share code, notes, and snippets.

@ddmitov
Created August 12, 2024 13:12
Show Gist options
  • Save ddmitov/6f6a80fb79fcd0017315793364691b77 to your computer and use it in GitHub Desktop.
Save ddmitov/6f6a80fb79fcd0017315793364691b77 to your computer and use it in GitHub Desktop.
Bash script for shrinking the size of PDF files
#!/bin/sh
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=out.pdf \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment