How Flattening a PDF Can Reduce Its File Size (and What You Lose)
Flattening is one of those PDF terms people reach for when a file is mysteriously heavy, but it does not always do what you expect. Sometimes it cuts a file down sharply; other times it barely moves the needle and quietly removes features you relied on. Knowing the difference saves you from a confusing export.
The situation
You have a PDF that feels too large for what it contains. Maybe it is a filled-in form, a marked-up contract, or a design export with a stack of layers. Someone tells you to "flatten it," so you do, and the result is unpredictable. This guide explains what flattening actually changes inside the file, which parts of the document shrink, and which stay exactly the same size.
Why flattening affects size (the mechanism)
A PDF is not a single flat picture. It is a collection of objects: the base page content, interactive form fields (AcroForm), annotations and comments, optional content groups (OCGs, better known as layers), and transparency groups that describe how overlapping elements blend.
Flattening collapses those separate objects into the page's own content stream. A form field stops being an interactive widget and becomes printed text. A sticky note or highlight stops being a separate annotation object and gets painted onto the page. Layers lose their on/off toggles and merge into one visible result. Transparency groups get rendered down so the viewer no longer has to compute blending on the fly.
Size drops when flattening lets the file discard overhead: duplicate field definitions, appearance streams stored twice, hidden layers that were never shown but still carried their full content, and heavy transparency groups that a renderer had to keep around. If a file has 200 form fields, each with its own appearance dictionary, merging them into static text can remove a lot of structural weight.
Size does not drop much when the heavy part of your PDF is scanned images or embedded photos. Flattening does not downsample images or re-compress photos, so an image-heavy scan stays roughly the same. That is the single most common reason flattening "did nothing."
How to flatten a PDF
Method 1: Flatten on export from the source app
The cleanest flatten happens before the PDF exists. In the app that produced the document, choose a "flatten" or "print to PDF" option, or export without preserving layers and form interactivity. Printing to a PDF printer renders everything to a single page layer by design.
Method 2: Flatten with Ghostscript
Ghostscript can rewrite a PDF and bake most interactive content into the page. A general pass looks like this:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 \
-dPDFSETTINGS=/ebook \
-o flattened.pdf input.pdf
The pdfwrite device reinterprets the document and resolves transparency as it writes. Because /ebook also downsamples images, you get flattening plus image compression in one pass. If you only want structural flattening without touching image quality, use /default instead of /ebook.
Method 3: Flatten, then target a size
Flattening removes interactivity but rarely hits an exact size on its own. When you have a hard limit, flatten first, then run the file through a size-targeting step so the images and streams are re-encoded to fit. PDF300 lets you enter the target size directly, so you set the number instead of guessing at quality presets.
Checklist
- Confirm what is making the file big first. If it is images, flattening alone will not help much.
- Decide whether you need the interactivity. Flattening is one-way; keep an unflattened master copy.
- Flatten form fields and annotations when the document is final and no longer needs editing.
- Merge or remove hidden layers (OCGs) that carry content you never display.
- Render transparency groups if a viewer struggles to open or print the file.
- Re-run compression or a target-size pass after flattening for the real size reduction.
FAQ
Does flattening a PDF reduce the number of pages or the resolution?
No. Flattening merges interactive and layered objects into the static page content; it does not remove pages or change image resolution. Page count stays the same, and photos keep their original pixels unless you also run an image downsampling step.
Will flattening make my form fields no longer fillable?
Yes, that is the trade-off. After flattening, form fields become plain text printed on the page and can no longer be edited, clicked, or submitted. Flatten only when the form is complete, and always keep an unflattened copy in case you need to change an answer later.
Why did flattening not shrink my scanned PDF?
Because the bulk of a scanned PDF is image data, and flattening does not touch images. It only collapses fields, annotations, layers, and transparency. To shrink a scan you need image downsampling or a target-size compressor that re-encodes the pictures themselves.