Reduce PDF File Size in Linux (Command line)
We can reduce pdf file size using either GhostScript or ps2pdf tools
1) Using GhostScript
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
-dPDFSETTINGS Option Description
-dPDFSETTINGS=/screen Has a lower quality and smaller size. (72 dpi)
-dPDFSETTINGS=/ebook Has a better quality, but has a slightly larger size (150 dpi)
-dPDFSETTINGS=/prepress Output is of a higher size and quality (300 dpi)
-dPDFSETTINGS=/printer Output is of a printer type quality (300 dpi)
-dPDFSETTINGS=/default Selects the output which is useful for multiple purposes. Can cause large PDFS.
2) Using ps2pdf
$ ps2pdf input.pdf output.pdf
or you can specify -dPDFSETTINGS as fellow :
$ ps2pdf -dPDFSETTINGS=/ebook input.pdf output.pdf
Join the conversation