How to shrink PDFs

pdfcomressSometimes a PDF document you’ve created is several megabytes in size due to high resolution images. This may cause problems when you want to send this PDF via email if the attachement’s size is limited by your email provider. There is a way you can reduce the file size of an existing PDF without having to render it again with low resolution images.

You can use the pdfwrite device module of Ghostscript to reduce image resolution in existing PDF files.

$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=small.pdf large.pdf

The options explained:

    Output PDF document
    Set Adobe's PDF specification compatibility level
     >=1.4 for font embedding
     =1.6 for OpenType font embedding
    =/screen   (screen-view-only quality, 72 dpi images)
    =/ebook    (low quality, 150 dpi images)
    =/printer  (high quality, 300 dpi images)
    =/prepress (high quality, color preserving, 300 dpi images)
    =/default  (almost identical to /screen)
    Disables the prompt and pause at the end of each page. This may be
    desirable for applications where another program is driving
    Exit after last file
    Send output to a file, - for stdout, |command for pipe,
    embed %d or %ld for page #

The compatibility level of the shrunk PDF should be the same as that of the original file to prevent complications. As for the resulting file size you may need to experiment with different PDFSETTINGS options until you get the filesize you desire. For more suffisticated options like paper size, image downsampling and more please refer to the Ghostscript man pages or the online documentation at and

About h0nk3ym0nk3y

h0nk3ym0nk3y is one of the three LinuxM0nk3ys from Linux M0nk3ys @ WordPress Linux M0nk3ys @ YouTube Linux M0nk3ys @ Twitter

Posted on August 11, 2015, in Command-Line, PDF and tagged , , , , , , . Bookmark the permalink. Leave a comment.

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

%d bloggers like this: