Friday, April 8, 2016

Using MAC OSX Preview to save PDF's in Different Sizes

If you are a MAC user, you have probably assumed that Preview (the MAC OSX PDF viewer) is just a viewer and can do little else.  If so, you would be wrong.  While there are a number of things Preview can do, one of the most important is that it can save PDF files in different sizes and quality levels.
Recently I had converted a a Microsoft Powerpoint to PDF and the file size was enormous, but the quality was very good.  I wanted to adjust the PDF quality and size.
By selecting File> Export, and then selecting one of the Quartz filters, I saw you can convert the open file to black-and-white or sepia tone, increase or decrease their lightness, and more.  One of those options was to reduce file size.  This is all good, but when I selected reduce file size the quality was too fuzzy in the graphics.  There appeared to be no way to further adjust the PDF file size and image quality.
Well, there is a great way to give yourself more choices.  The Quartz filters are located in the folder /System/Library/Filters.  These are XML files that are easily edited with TextEdit or any other text editor.   If you look at the file for the Reduce File Size filter, you will see two of the parameters:
  • Compression Quality
  • ImageSizeMax
These are too low (0.0 and 512, respectively).
So here is what to do.  Make three copies of this file to the Desktop.  Then on the desktop copies, rename each one as follows and edit each file with the parameters as shown in the table:

NameCompression QualityImageSize
Reduce File Size Good0.25842
Reduce File Size Better0.51684
Reduce File Size Best0.753508

Lastly, you need to change the default string for the Name key at the end of each file (this is what displays in the Export menu) to match its file name.

Here is an example:
Screen Shot 2016 04 08 at 7.19.13 AM
Now in your Finder, create a /Library/Filters folder and then move all three edited files in that new folder.  You will not be able to put them in the /System/Library/Filters folder.
Close and re-open Preview.  Open a PDF, and then select File> Export, you will see the new Quartz Filters!  You can experiment with the new settings to find the file size and image quality that works best for you.