Reducing PDF File size

I took some photos and made a huge PDF of them on Omnigraffle (OSX).

Now I need to email that PDF, but since every photo is 5MB, the file is huge. I don't need the high-res photos when I email it though.

So what program will take my PDF, resize all the images to low resolution and save it?


Solution 1:

Open the PDF in Preview, Select File » Save as…, and select the Quartz Filter named Reduce File Size.

enter image description here


Use ColorSync Utility to fine-tune the filter. Duplicate Reduce File Size and change settings afterwards.

I suggest you first try clearing all values from the Image Sampling block, except Resolution, which should be around 150-300 DPI, depending on how much you want to save.

enter image description here

Solution 2:

Inspired from Max Glenister & Milan Kupcevic, Thanks to Burgi, explanation of the example script : It reduce PDF size from Massive to Small using ebook filter

brew install ghostscript # aptitude work too if you do not have brew

compresspdf() {
    echo 'Usage: compresspdf [input file] [output file] [screen|ebook|printer|prepress]'
    gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1"
}

compresspdf "Massive.pdf" "Small.pdf" ebook

Gs Options:

-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)

Solution 3:

I don't know of a program that will do what you want, but an alternative to produce the same end result would be to compress the images with a graphics program first, and then put them into a document and convert it to PDF.

Solution 4:

Based on @Mickaël's answer, if you don't want to install gs to your machine with all of its dependencies, you can also convert the PDF files within a docker container:

docker run --rm -v (pwd):/app -w /app minidocks/ghostscript -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -sOutputFile="/app/compressed.pdf" /app/source.pdf