- Install GhostScript
sudo apt install ghostscript #ubuntu
- Run
gs -sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE \
-dBATCH \
-dQUIET \
-sOutputFile=compressed_file.pdf \
original_file.pdf
web wasm version https://laurentmmeyer.github.io/ghostscript-pdf-compress.wasm/