Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Created July 30, 2024 20:21
Show Gist options
  • Save wellington1993/9bbddf3a7cb6db3d60bc78a4d0b66508 to your computer and use it in GitHub Desktop.
Save wellington1993/9bbddf3a7cb6db3d60bc78a4d0b66508 to your computer and use it in GitHub Desktop.
Reduce PDF Size
#!/bin/bash
# Script to compress PDF files, be carefull with signed docs
# Original Size: 241M
# output.pdf
# Reduce PDF Size using QPDF
# new size: 217M
qpdf --compress-streams=y --object-streams=generate output.pdf output-qpdf.pdf
# Reducing using Mutool
# new size: 173M
mutool clean -gggg -l -z -f -i output-qpdf.pdf output-qpdf-muclean.pdf
# Reducing again using qpdf
# new size: 160M
qpdf --compress-streams=y --object-streams=generate output-qpdf-muclean.pdf output-compressed.pdf
# Compressing the resulting PDF
# new size: 149M
bzip2 -9 output-compressed.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment