Reducing PDF file-size in Linux

The other day I downloaded a PDF that ended up being a whole lot bigger than I thought. A “whopping” 230MB, which is another deal compared to the 30MB PDF’s that I’m accustomed to. So how to reduce the file-size? Ghostscript to the rescue!

If you have Ghostscript installed, run the following command to reduce the file-size of your PDF:

Now you have a few options here under -dPDFSettings:

  • /screen selects low-resolution output, and the lowest file-size.
  • /ebook selects medium-resolution output, with a medium file-size.
  • /printer and /prepress are both the high-resolution options, which is mainly used for printing PDFs. As you might have guessed, this option gives you the biggest file-size (yes, even bigger than your mother).

The results?

What can I say. I’m a cheap bastard when it comes to storage space, no matter how low the price might be. 😉

20 thoughts on “Reducing PDF file-size in Linux

  1. Yaroslav Nikitenko

    The author should add that it takes a lot of time (and considerable CPU resource) to perform this task. After the 4th minute with the ‘screen’ option I gave up…(

    Reply
      1. Aditya Raj Bhatt

        Reading my comment again after two years, I can safely say that it was overly aggressive and rude. I have noticed the slowing down of conversion for large pdf files on my own machine, so I was stupid back then 🙂

        Reply
    1. Danquebec

      Compressing large files often take a lot of time. I compressed a 572 pages PDF file, it took me several dozens of minutes, but it was worth it. I can now browse it fluidly.

      Reply
  2. Pingback: Reduzindo o tamanho de um arquivo PDF | Admirável Trivialidade Nova

  3. Michael

    Really great tip! Thanks!
    I used it to reduce the size of pages I scanned with xsane.
    The reduction in file size is dramatic while the results look really good!

    Reply
  4. Pingback: Helping a friend | nochkawtf

  5. Pingback: Bookmarks for 22 mag 2015 through 29 mag 2015 | jtheo

    1. Jorge Enrique Barrera Post author

      To compress multiple files, you could try something like:

      for i in *.pdf; do "gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=new_$i $i"; done

      This will compress all of the PDF-files in the directory you’re currently in.

      Reply
  6. kiai

    What’s dCompatibilityLevel? Is this the Adobe PDF version? If so, 1.4 would result in fragmented images. v1.6 is the “digital standard”.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *