Compress PDF Files w/ Linux The Easy Way
For those of you who are always sharing graphics intensive pdf files, having a way to compress the final output before sharing it via whatever medium you choose is important. A great example would be that one of my UI designers creates these 31+M UI flow diagrams in pdf format and before I share it with clients, I always compress them to a sharable size.
As most of you Linux gurus know, there’s always the gs command that looks something like this:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.6 -dPDFSETTINGS=/ebook
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf
"input.pdf"
That seems like an awful long command to remember every time you wanted to compress a pdf file but not to worry, there’s a python script out there that can help simplify things!
Download the script and throw it into a bin folder that’s defined in your shell environment. This way, you are able to execute the cpdf script like a command from anywhere and you won’t need to define the full path of files when defining your input and output file arguments.