A scanned document saved as PDF can be too large, that is not always good.
For example, the large size of a PDF file won’t permit to send it by email because of the probable limitation on the maximum size of attachments.
In Linux you can compress a PDF file from the command line without losing its quality, with the help of
ps2pdf tool, that is a part of
From this article you will learn how to compress a PDF file and significantly reduce its size from the Linux command line.
Cool Tip: Plan to send this PDF somewhere or just keep? How about to protect it with a password? This is really easy for ones who reduce the size of a PDF file from the command line! Read more →
First of all it is required to install the
ghostscript suite that provides the
$ sudo apt-get install ghostscript
Compress PDF File In Linux
Run the following command to compress and reduce the size of the
LARGE.pdf file and save the result to the
$ ps2pdf LARGE.pdf SMALL.pdf
Effectiveness is obvious:
$ du -sh *.pdf 7,6M LARGE.pdf 500K SMALL.pdf
You can also you this command to reduces the size of a PDF file:
$ gs -sDEVICE=pdfwrite \ -dCompatibilityLevel=1.4 \ -dDownsampleColorImages=true \ -dColorImageResolution=150 \ -dNOPAUSE \ -dBATCH \ -sOutputFile=OUTPUT.pdf INPUT.pdf