Wednesday, January 29, 2014

Reduce PDF File Size - More options for Mac

On my Mac, I needed to reduce the size of some scanned PDF documents - without changing the scanner settings and rescanning them. I tried to Export from Preview as a PDF using the “Reduce File Size” filter, but it made the files too blurry.

Googling revealed a nice solution, which allows you to add your own custom “Reduce File Size” filters to Preview’s Export window. Once you’ve done this once, you can use them whenever you need to:

New Reduce File Size Filters

I am going to repost how to do this here, so I don’t lose it. The original can be found at: http://hints.macworld.com/article.php?story=20120629091437274

I was never satisfied with results of "Reduce File Size" Quartz filter when trying to make some PDFs smaller before sending them by e-mail. It made them too small, and the graphics were fuzzy. 

I eventually found where these filters are: 

/System/Library/Filters 

I was delighted to find out they're XML files easily editable with TextEdit (or any other text editor). I also found why this particular filter makes quite unusable PDFs, as these parameters were just too low: 

Compression Quality 0.0
ImageSizeMax 512 

So I copied this file to my Desktop, and then made two more copies of it, and called them Reduce File Size Good, Better and Best. Then I changed the parameters of each file to 0.25, 0.5 and 0.75 for Compression Quality, and used these three values for ImageSizeMax: 

842 (that's A4 at 72dpi)
1684 (A4 at 144dpi)
3508 (A4 at 300dpi) 

Finally, I changed the default string for the Name key at the end of each file to reflect the three settings, so they display the names I have given them in the menu. 

Then I copied them to a /Library/Filters folder I created (for some reason, ~/Library/Filters doesn't work in Lion) and now when I open a picture or PDF in Preview, I have the option of four different qualities for reduced file sizes. 

As an example, I have a JPEG of scanned A4 invoice at 300dpi and it's 1.6MB. When exporting to PDF in reduced size, the file is only 27 KB and it's quite unusable - very fuzzy and hard to read. The Good one is much easier to read, slightly fuzzy and still only 80 KB. Better is 420 KB and clear, and the Best is 600 KB and almost as good as the original even on a laser printer.

A few notes:

  • As well as copying and renaming the *.qfilter files, you also need to change the “Name” parameter in the XML document, from “Reduce File Size” to “Reduce File Size Good” (or whatever).
  • You’ll need to use “sudo…” to create the /Library/Fileters folder and to move the files in there.