compress images in pdf files

30 06 2011

so this might be useful if you want to forward/store a pdf file (newsletter etc.) that contains uncompressed images. Using ghostscript you can resize them inside the pdf file.
$ pdfcompress inputfile.pdf outputfile.pdf

#!/bin/bash
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$2 $1
# more options:
# http://milan.kupcevic.net/ghostscript-ps-pdf/


With thanks to Milan Kupcevic for the inspiration. More options (especially regarding the image resolution) can be found on his page.

Advertisements

Actions

Information

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: