In this short guide I will show you how to dramatically decrease PDF file size in case there are a lot of photos inside. If there is only text, that is not going to work.
The great thing is that you don't need to install any additional software. We will use build-in application called Preview, which is used for viewing PDF documents on macOS.
Preview allows to save opened documents in different formats and even to optimize PDF files, but the problem is that the quality of the output PDF is pretty poor.
The good news is that macOS is a pretty flexible system and it allows to create your own presets for saving PDF files. This is exactly what we are going to do.
This tutorial is for very beginners and includes step by step instruction for each step.
If you are an expert user, go to the last part of this page with a download link and short instruction.
I made separate folder for my PDF experiments. Also, I checked the file size before optimization. Right click on the file, then select Get Info from context menu. It is 202MB — such a heavy presentation. Let's make it possible to send it via email. Gmail has 25MB limit. Challenge accepted!
Let's optimize our file using build-in preset. The quality will be horrible, but let's try it. Double click on your PDF to open it using Preview.Go to File → Export.
Export As window appears. Set new file name for your optimized file. I just added -v2 ending. Then set field Format to PDF. Now click on Quartz Filter and select Reduce File Size option. Click on Save.
Now go to the saved file and check the size. I was amazed by the results! How is this possible? The thing is that Preview increased compression rate and scaled down all the images stored inside the document. Can you imagine how bad they are after our manipulations? Almost 70 times smaller size...
Here is a visual comparison of the same PDF before and after optimization. A picture is worth a thousand words!
After photos are pixelated, the sharpness reduced, you can clearly see compression artifacts. Build-in preset is not usable in our case, but, luckily, we can fix this in a few minutes.
Please note, that you need administrator permissions to do this trick. Open Finder and press Shift + Command + G or go to Finder's menu and select Go → Go to Folder...
Type in path /System/Library/Filters and click Go. This magic folder stores all Quartz Filter presets (including our Reduce File Size we just tried) in separate files. Each file describes compression and scale parameters in XML format. Don't worry, this is pretty simple.
Now we need to make a copy of the original preset, alter & rename it, and copy back. To copy this file, right-click on it and select Copy "Reduce File Size.qfilter".
Go to your folder with PDF files via Finder, right-click on empty space and select Paste Item. Filter file will appear. Click on it to select and press Enter to rename it. I added My at the beginning of the filename. Press Enter again to confirm changes.
Now it is time to change the content of the filter file. Right-click on it and select Open With → Other....
In the next window you need to choose which program to use to open the file. As the content is just a text choose TextEdit.app and click Open.
Scroll down to the end of the file. This is the part we need to alter. As you can see it is pretty self-explanatory.
Compression Quality is set to 0.0 by default (!), which means it is the worst possible value. The best is 1.0. Let's set it to 0.5.
ImageScaleFactor is set to 0.5. That means that each picture will be scaled down by 50%. Oh I thought Apple is all about quality... Just kidding. Set the value to 1.0.
ImageSizeMax equals to 512. So your images width and height can't be larger than 512 pixels. Set it to 2048. It should be enought for viewing on retina displays and not so bad for printing.
ImageSizeMin equals to 128. Pretty small size. This is a limit for minimum width and height. Set it to 512.
Name is Reduce File Size. It is used for the name inside Quartz Filter list when exporting. Change it to our new file name My Reduce File Size.
Press Command + S to save changes. Copy this file to /System/Library/Filters folder. Do you remember I told that you would need to have admin's permissions? When you paste the new filter file you will be asked to enter the admin's password. Type it in and press Enter.
Now we are ready to apply the new custom filter. Let's find out if it is better than the old one.
Open the original PDF file with Preview. Export as usual and check Quartz Filter dropdown list. Nice, here is our custom filter!
Add -v3 to the end of new file and press Save.
New filter produced a 27.4MB file (remember, original file size was ~200MB and compressed with original filter 2.8MB). Not too bad, let's compare the same piece of the original PDF side by side. There is no visible difference!
At the beginning of this guide we set size limit to 25MB. Our current result is slightly bigger. Let's alter our filter one more time to get smaller size.
Set Compression Quality to 0.4, ImageScaleFactor to 0.9, ImageSizeMax to 1504. Save fiter settings and paste new version. After exporting I got 18.7MB. Mission accomplished!
Sure thing you can experiment with the parameters and get different, even better results. The question is do you have time for this. Ping me in comments if there is something interesting you found.
I prepared a zip file with those two custom Preview filters we just created. Download them, unzip to folder /System/Library/Filters and you are ready to go (no need to restart macOS or even Preview application, just select Export command one more time). After that two new filters appear in Quartz Filter dropdown when exporting to PDF:
If you get any trouble, just leave a comment and I will help. Also, please let me know if that worked for you. Thanks!
More like this
Add First Comment. Start a Discussion