how to compress pdf in ubuntu?

I Want to know how to compress pdf in ubuntu? Please don't recommend Ghostscript Because In some cases the Ghostscript doesn't Compresses file but make the file size greater than the original file.


No, PDF documents are already optimized for compression.

A PDF uses internal compression for its objects. Font files by default are compressed so embedded fonts are also already compressed. The few characters in a pdf that are not compressed will not make a dent in the filesize.

Ghostscript Because In some cases the Ghostscript doesn't Compresses file but make the file size greater than the original file.

Ghostscript is excellent for this. But compressing what already is compressed will cause overhead (and indeed make the file larger). IF it is a file that can be compressed Ghostscript will make the file smaller.

It has nothing to do with PDFs even a small text file does this:

  • As a test: 100 1's in a file

      $ more test  
      111111111111111111111111111111111111111111111111111111111
      111111111111111111111111111111111111111111
      $ ls -l test
      -rw-rw-r-- 1 rinzwind rinzwind 100 Oct  8 17:23 test
      -$ gzip test
      ~$ ls -ltr test
      -rw-rw-r-- 1 rinzwind rinzwind 30 Oct  8 17:20 test.gz
      ~$ mv test.gz test
      ~$ gzip test
      ~$ ls -ltr test*
      -rw-rw-r-- 1 rinzwind rinzwind 55 Oct  8 17:20 test.gz
    
  • Single zipping filesize goes from 100 to 30

  • Double zipping makes the filesize go from 30 to 55.