How to Reduce PDF File Size

Ghostscript is a versatile software suite primarily serving as a PostScript and PDF file interpreter. It offers native rendering for various formats, including PDF, PostScript, PCL, XPS, raster, and vector files. Functioning as an interpreter for PostScript and PDF files, Ghostscript plays a pivotal role in converting PostScript to PDF and vice versa. Developers and designers benefit from Ghostscript's capabilities, bridging the gap between complex document formats and accessible visual output. It is often used as the #1 PDL (Page Description Language) conversion and interpreter tool.

Install Ghostscript
brew install ghostscript
How to Install Homebrew
Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with macOS. It can also install software not packaged for your Linux distribution without requiring sudo. Install Homebrew /bin/bash -c ”$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” brew
Use Ghostscript to Reduce PDF File Size
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Automating Ghostscript With Hazel

Hazel automation is Folder-based automation that makes life easier on macOS. Rules-based actions on new items in folders, including renaming, reorganizing, moving, importing, uploading, and pushing notifications.

Users create rules to guide Hazel's actions, making it a powerful tool for managing clutter and saving time on repetitive tasks. With features like rule-making and automated tasks, Hazel enhances file organization, transforming chaotic desktops into streamlined, efficient spaces for Mac users. It excels in managing specific folders and offers a user-friendly interface for creating and managing automation rules.

#/bin/bash
NEWNAME=$(basename -s .pdf $1)

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="Output/$NEWNAME-compress.pdf" "$1.pdf"
References
Reduce PDF File Size With Ghostscript
I’m going to be honest. I don’t worry too much about PDF file size. Storage (both local and online) is relatively cheap. However, sometimes people will ask me how to reduce PDF file size, so it’s clearly a topic of interest. There are many solutions out there, but over on the Asian Efficiency Dojo, user […]
Welcome to Ghostscript — Ghostscript 10.03.0 documentation
The Ghostscript documentation
How can I reduce the file size of a scanned PDF file?
I have a 72.9 MB PDF file that I need to shrink to 500 KB or below. The file was a JPEG image that I had scanned and then converted to PDF.