New Tool Radar

AI PDF

How to Compress a Scanned PDF with Ghostscript Presets

Compress a scanned PDF with Ghostscript so it is small enough to email without losing the text layer.

Schematic illustration of Ghostscript compression: check the install, compress with the ebook preset, and check the text still searches.

Ghostscript rebuilds a PDF with its pdfwrite device, downsampling the images to a target resolution chosen by the -dPDFSETTINGS preset: /screen, /ebook, /printer or /prepress. The text stays sharp because only the images are downsampled. This guide compresses one scanned PDF with the /ebook preset.

Prerequisites

Ghostscript installed and a scanned PDF. Work on a copy, since Ghostscript writes a new file and the original is never touched.

Steps

1. Check the Ghostscript install

Run gs –version in a terminal. Expected result: a version number prints.

2. Compress with the ebook preset

Run gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=small.pdf scan.pdf. Expected result: small.pdf is created.

3. Compare the file sizes

Compare the sizes of scan.pdf and small.pdf. Expected result: the compressed file is smaller than the original.

4. Check the text still searches

Search small.pdf for a word from the page. Expected result: the search returns a hit, proving the text layer survived.

Practice check: fictional 12-page scanned report, ebook preset

The table below is fictional practice material. It lists the four checks for the compressed file.

Check Expected result
Version printed A version number prints
Output created small.pdf exists
Size reduced Smaller than the original
Text searchable harvest returns a hit

Expected result. the compressed file is created, it is smaller than the original, and the word harvest is still searchable in it.

Limits

  • Ghostscript rebuilds the document, so form fields, some annotations and accessibility structure may not survive; check the output before sharing it.
  • UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.

Sources

See all