TIL: Smaller PDFs
About 1 min reading time
Now and then I want to create PDFs and optimize the file size. I'm not necessarily in the mood to add another PDF software to my computer, and, depending on the content of the document, I don't want to complete the task online. In this situation, you can do well with Ghostscript.
The first thing you have to do is install Ghostscript on your computer. On a Mac with Homebrew, you can accomplish this with the following command:
brew install ghostscript
To optimize a PDF, I use the following command.
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output.pdf" input.pdf