« Rewrite URL to remove duplicate content | Main | Stock import View for data tables »

March 03, 2011

How to compress pdfs in Ubuntu

Option 1:

Install pdftk
$ sudo apt-get install pdftk

Compression command.
$ pdftk output.pdf output final.pdf compress

- Noticed no difference if file size.

Option 2:

Take the file to .ps and back to .pdf:

$ pdf2ps input.pdf output.ps
$ ps2pdf output.ps output.pdf

- This approach threw an error because my input.pdf was malformed.

Option 3:

Reprint the pdf with Okular

$ okular input.pdf

Print > Print to File (pdf)
Options > PDF Options > Force rasterization

This reduced the file form 18 mb to 6.1 mb where the previous options failed. I retried Option 1 and 2 after this step and no change in size was observed.

Option 4:

I also had success with opening the following, which is the GUI version of Option 2:

Open large_input.pdf in Okular (or Evince) > Print as large_output.ps

Open large_ouput.ps in Okular (or Evince) > Print as small_output.pdf

Posted by kkwaiser at March 3, 2011 02:31 PM


Login to leave a comment. Create a new account.