How to reduce PDF file size in Linux

Using a single line of GhostScript command on my Ubuntu’s terminal, I was able to reduce the size of a  PDF file from 6 MB to approximately 1 MB:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf input.pdf

You can also use the following parameters for -dPDFSETTINGS instead of /screen:

  • /screen – Lowest quality, lowest size
  • /ebook – Moderate quality
  • /printer – Good quality
  • /prepress – Best quality, highest size

13 thoughts on “How to reduce PDF file size in Linux”

  1. Thank you! Worked fine for me! I used before, but had some issues …

  2. Sir! You’ve saved my life but not because of the size! This method is also useful if you want to erease embedded metadata in the PDF without harming the bookmarks and the table of content! This is brilliant.

    On linux the method is:
    – Ghost Script removes the embedded data and some other
    – Exiftool removes the remaining data
    – Qpdf linearization can make the exiftools modifications permanent.

Comments are closed.