How to Flatten a PDF on Linux — Browser and Ghostscript Methods
Flatten PDF form fields and annotations on Linux using a browser tool or Ghostscript. Permanently embed interactive elements without proprietary software.
Flatten PDFs on Linux using a free browser tool or command-line utilities. FixMyPDF's Flatten PDF tool works in Firefox or Chrome, while Ghostscript handles batch flattening from the terminal.
Method 1: Browser-Based Flattening
Open Firefox or Chrome on your Linux system. Navigate to fixmypdf.in/tools/flatten-pdf. Upload your PDF. Click "Flatten PDF". Download the flattened result. Works on Ubuntu, Fedora, Debian, Arch — any distro with a modern browser.
Method 2: Ghostscript Flattening
Ghostscript linearises and flattens interactive content when re-processing the PDF: gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=flat.pdf input.pdf. Install: sudo apt install ghostscript (Debian/Ubuntu) or sudo dnf install ghostscript (Fedora).
Method 3: pdftk Flatten
pdftk can flatten form fields: pdftk input.pdf output flat.pdf flatten. This is the simplest CLI method for form-field-only flattening. Install: sudo apt install pdftk. Note: pdftk may not flatten all annotation types — Ghostscript is more thorough.
Verifying Flattening on Linux
After flattening, open the PDF in Evince or Okular. Try clicking on areas that were previously interactive form fields. If flattening succeeded, there will be no interactive cursor change and no field activation. Run pdfinfo flat.pdf and check for absence of form data.
Batch Flattening on Linux
To flatten all PDFs in a directory: for f in *.pdf; do gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="flat_$f" "$f"; done. Useful for processing directories of received forms or archived interactive documents.
When to Use Browser vs CLI
Browser tool: quick one-off flattening with visual confirmation. Ghostscript: batch processing, server-side automation, headless environments (no display). pdftk: simple form-field flattening in scripts where Ghostscript is not available.
Checking Results
Compare file sizes after flattening: ls -lh *.pdf. Flattened PDFs may be slightly larger or smaller depending on the original. Open in your Linux PDF viewer to visually verify the content looks correct before distribution.
Try Flatten PDF Now — Free
Browser-based, private, and instant. No account or software required.
Open Flatten PDF


