Compress PDF

Command Line Utilities to Reduce PDF File Size in Linux

Using GhostScript

sudo apt install ghostscript

You can use this command to compress PDFs. Replace output.pdf/input.pdf and the PDFSETTINGS as required.

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
-dPDFSETTINGS Option Description
-dPDFSETTINGS=/screen 72 dpi
-dPDFSETTINGS=/ebook 150 dpi
-dPDFSETTINGS=/prepress 300 dpi
-dPDFSETTINGS=/printer 300 dpi
-dPDFSETTINGS=/default Multi purpose output PDF.