Hi, I'm Chris

This blog is about programming, linux and other stuff.
Please don’t hesitate to contact me if you have any questions or suggestions for improvements!

Compress pdf files using the command line and Ghostscript

I really hate it when people mail me super large pdf files and therefore I myself compress them before I send them out. Unfortunately, the build-in OS X Scanner application does not provide pdf compression. Luckily, there is Ghostscript and someone already wrote a small script to make this process handy.

This script worked for me most of the time but I always got a warning and sometimes it just crashed:

SetUseCIEColor for UseDeviceIndependentColor to work properly
Unrecoverable error: stackunderflow in .setdistillerparams

After adding -dUseCIEColor I got rid of them and the script now looks as follows