I seem to get into this more often than I need to. I was preparing a report this weekend that grew to ~500 pages and 80 MB in size. I wanted to transmit the report as a .pdf via email. Using services like OneDrive work, but they are annoying when they require an external user to verify who they are. I also tried reducing the file size with a few other options, including:
- PDFCompress, an old app on my Mac
- Preview, using it’s Export option
- Others I’m forgetting to list here
None of the options above produced a small enough .pdf file or at least not one that was less than 50 MB. Finally I turned to Ghostscript, but first I had to install and configure it:
1. Open Terminal.app and enter: brew install ghostscript
2. After Ghostscript installs, use Terminal to navigate to the folder containing your .pdf, in my case: ls ~Desktop
3. Insert this command into Terminal, replacing input.pdf and output.pdf with the file names you prefer:
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output.pdf" "input.pdf"
The above-command produced a file about 38 MB and I was able to get it down to 36 MB using the following command:
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile="output.pdf" "input.pdf"
I found these references helpful in developing this approach:
https://gist.github.com/ahmed-musallam/27de7d7c5ac68ecbd1ed65b6b48416f9
https://www.cisdem.com/resource/shrink-pdf-file-size-on-mac.html