<p>
Ghostscript is the open source implementation of Postscript. You can read its <a href="https://www.ghostscript.com/doc/current/Use.htm" target="_blank">docs</a> online.
</p>

<p>
To compress a big PDF into something possibly smaller:
</p>

<pre><code>
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dBATCH -sOutputFile=output.pdf example.pdf
</code></pre>

<p>
That renders basically the same PDF with all images down-res'd to 72 DPI. Other valid setting profiles are <strong>ebook</strong>, <strong>printer</strong>, and <strong>prepress</strong>.
</p>

<p>
To render a version of a PDF without any raster images in it, making it cheaper and faster to print:
</p>

<pre><code>
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dBATCH -dFILTERIMAGE -sOutputFile=output.pdf example.pdf
</code></pre>

<p>
The FILTERIMAGE option drops raster images from the file. The <strong>FILTERVECTOR</strong> option filters vector images, and <strong>FILTERTEXT</strong> filters text.
</p>

<p>
If <a href="https://hackerpublicradio.org/eps.php?id=2667" target="_blank">pdftk</a> is not available for your OS, you can use <a href="https://github.com/hellerbarde/stapler" target="_blank">pdf-stapler</a> instead for cutting and concatenating PDF files. It doesn't deal with metadata as well as pdftk does, however.</p><p>It's worth noting that pdftk is available as a snap package <a href="https://snapcraft.io/pdftk" target="_blank">https://snapcraft.io/pdftk</a>.
</p>

<p>
It's also worth noting that this is actually episode 2 in a series about steganography.</p>

