Compress PDF-Files on Linux (using Ghostscript)

I recently scanned some letters and wanted to send them via email. However, the filesize was not what I like it to be to send it via mail. I was searching for a command line tool and then came across this page (from Alfred Klomp): Shrinkpdf – just make yourself a nice bash script using ghostscript. I increased quality a bit, so I came to this version:


gs    -q -dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.3 \
-dPDFSETTINGS=/ebook \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
-dColorImageDownsampleType=/Bicubic \
-dColorImageResolution=150 \
-dGrayImageDownsampleType=/Bicubic \
-dGrayImageResolution=150 \
-dMonoImageDownsampleType=/Bicubic \
-dMonoImageResolution=150 \
-sOutputFile=out.pdf \

Just save this as an executable file [e.g. on the terminal type: touch shrinkpdf; mcedit shrinkpdf; paste the code from above, save(F2) and exit (F10), make it executable (chmode u+x shrinkpdf)] and then type: ./shrinkpdf input.pdf (the latter being the pdf-file to compress) and you will obtain a file called out.pdf containing a compressed version of input.pdf.

Have fun!


One thought on “Compress PDF-Files on Linux (using Ghostscript)

  1. Pingback: Compresión de PDFs usando Ghostscript bajo Linux | Técnicos. La Barra

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s