Compress PDFs With Ghostscript

Rewrite a PDF with lower image resolution to shrink its size.

LinuxcompressconvertpdfLow risk
Run gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o small.pdf big.pdf to compress.

01Command

Command
$ gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o small.pdf big.pdf

02What it does

Ghostscript renders and re-emits PDFs, and the PDFSETTINGS presets (/screen, /ebook, /printer, /prepress) trade image quality for size. It can also convert PostScript or EPS to PDF and flatten transparency.

03Risk

RiskLow risk
Requirementssudo apt install ghostscript
!Warning: Re-encoding reduces quality and can change fonts or embedded colour; keep the original until you verify the result.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Ghostscript
    Official project · vendor-doc · 2026-09-20
    Evidence: Debian packages Ghostscript, a PostScript and PDF interpreter used to rewrite and optimise documents.
  • Debian package: ghostscript
    Debian · vendor-doc · 2026-09-20
    Evidence: Debian packages Ghostscript, a PostScript and PDF interpreter used to rewrite and optimise documents.

Last verified: 2026-09-22 · Category: Developer