Skip to content

Instantly share code, notes, and snippets.

@wteuber
Forked from knugie/reduce_pdf.sh
Last active January 14, 2026 16:22
Show Gist options
  • Select an option

  • Save wteuber/859850a85ac475cb451d3cb0644e67df to your computer and use it in GitHub Desktop.

Select an option

Save wteuber/859850a85ac475cb451d3cb0644e67df to your computer and use it in GitHub Desktop.
reduce pdf size
#!/usr/bin/env bash
# Reduce PDF size - http://www.alfredklomp.com/programming/shrinkpdf/
# -dPDFSETTINGS
# /screen
# /ebook
# /printer
# /prepress
infile="$1"
if [ -z "$infile" ]; then
echo "Usage: $0 input.pdf"
exit 1
fi
outfile="${infile%.pdf}.min.pdf"
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook -sOutputFile="$outfile" "$infile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment