BASALT · JOURNAL
What flattening a PDF actually does, and when you need it
"Flatten the PDF" is advice given for at least four unrelated problems, and it only solves two of them. It is also routinely mistaken for a security measure, which it is not. This post covers what flattening does at the object level, which problems it genuinely fixes, and the case where relying on it will expose information you meant to remove.
The structure flattening removes
A PDF page is drawn from its content stream: a sequence of operators that place text, paint paths, and draw images. That stream is what a renderer executes and a printer receives.
Sitting above the page, but not inside that stream, are annotations. Each is a dictionary attached to the page's /Annots array, with its own rectangle, its own type, and usually its own appearance stream in /AP. Comments, highlights, stamps, free text boxes, and form field widgets are all annotations. Form fields add a layer on top: a field dictionary holds the value in /V, its widget holds the appearance stream that draws that value, and the catalog's /AcroForm dictionary ties the fields together.
Flattening takes the appearance streams of those annotation objects, writes their drawing operators into the page content stream at the right position, and then deletes the annotations and the AcroForm structure. What was a separate interactive object becomes ordinary marks on the page, indistinguishable from text and graphics that were always there.
What that actually buys you
Fixed rendering. An annotation's appearance can be regenerated by the reader. Form field appearances get rebuilt using default settings when /NeedAppearances is set, which changes fonts, sizes, and alignment. Once the marks are page content, no reader rebuilds anything.
No more editing. After flattening there are no fields to type in and no annotations to drag, delete, or reword. This is the reason to flatten before sending a final document, covered from the form side in filling in a PDF form so the values stay put.
No form data extraction. Form values are readable through the AcroForm structure by anything that walks it, independently of what appears on the page. Flattening removes that structure, so there is no field to read a value out of. The value is still visible; it is just no longer form data.
Annotation authorship removed. Markup annotations carry /T for the author, /M for a modification date, and /Contents for the comment body. Flattening a comment's appearance and deleting the annotation removes those. Annotations are a category in hidden data in PDFs.
What flattening does not do
It is not redaction. Flattening converts marks into other marks. Text drawn by a form field becomes text drawn by the page, and it copies and pastes exactly as before. Nothing is concealed and nothing is destroyed.
The dangerous version of this mistake is flattening a document where somebody drew a black rectangle over sensitive text. Flattening merges that rectangle into the page content. It does not remove the text underneath, which stays exactly where it was, still extractable with a copy and paste. See how to redact a PDF on a Mac for what actually removes content, and verifying a redaction for how to prove it.
It is not compression. Flattening changes file size very little, because appearance streams were already in the file and get moved rather than added. If a file is large, the cause is nearly always DCTDecode image streams or embedded fonts.
It does not remove metadata. The Info dictionary, XMP packets, the file identifier, and embedded attachments live at document level, untouched by page-level flattening. Cleaning those is a separate pass, described in removing metadata from a PDF.
It does not remove an OCR text layer. Recognized text from a scan is drawn in text rendering mode 3, positioned but not painted. It is already page content, so flattening has nothing to convert, and that invisible text stays fully extractable.
It does not rasterize. Some people mean "turn every page into an image" when they say flatten. That is a different operation: it destroys all real text, usually enlarges the file, and leaves the document unsearchable and inaccessible to screen readers.
When to flatten, and when not to
Flatten when a document is final and you want it to look and behave identically for everyone: a completed application form, a signed agreement, an invoice with filled fields. Flatten when a recipient must not alter entries or read values back out of form structure. Flatten before archiving, so the document does not depend on a future reader regenerating appearances correctly.
Do not flatten when you still need to correct entries, since it is not reversible and you would be retyping into a form that no longer exists. Keep a working copy.
Do not flatten as a privacy step. If information must not reach the reader, remove it, verify it is gone, and only then consider flattening what remains.
Frequently asked questions
What does flattening a PDF do?
Flattening writes the appearance of annotations and form fields directly into the page content stream and then deletes those interactive objects, so what was editable becomes ordinary marks on the page. After flattening there are no fields to fill, no comments to move, and no form values to extract through the document structure. The page looks identical; the difference is entirely structural.
Does flattening a PDF make it secure?
No, flattening changes marks into other marks and removes nothing from view. Text that a form field drew is still text after flattening and still copies and pastes normally, and any content sitting under a black rectangle stays fully present and extractable. Flattening prevents editing, not reading. Removing information requires redaction that destroys content, verified afterward on the written file.
How do I flatten a PDF on a Mac?
Use a PDF tool with a flatten or lock function, which converts form fields and annotations into page content and writes a new file. Printing to PDF from Preview flattens many annotations as a side effect, though it can alter page geometry and drop document-level structure. Whichever route you take, open the result and confirm every filled value still appears.
Does flattening reduce PDF file size?
No, not meaningfully, because the appearance streams being flattened were already stored in the file and are moved rather than created. File size in a large PDF is almost always driven by embedded images and fonts, which flattening does not touch. If you need a smaller file, use a compression pass instead.
Will flattening remove the black boxes I drew over sensitive text?
No, and more importantly it will not remove the text under them either. A black rectangle is a filled path in the page content stream, and the text beneath it is separate content that remains fully extractable by copy and paste. Flattening merges objects; it never deletes what is covered. Only a redaction that removes the underlying content, then verifies the written file, achieves that.
Does flattening remove metadata from a PDF?
No, flattening operates on page-level annotations and form fields, while metadata lives at document level in the Info dictionary and XMP packets. Author names, original file paths, edit history, the file identifier, and any embedded attachments all survive a flatten untouched. Removing them takes a separate metadata cleanup pass, which is worth running on anything leaving your organization.
Should I flatten before or after redacting?
Redact first, verify the redaction on the written file, then flatten if you still want the document locked. Flattening first buries form values and annotation content into the page, which makes them harder to identify and target when you come to remove them. Redaction is the operation that must succeed, so give it the cleanest structure to work against.
Doing it in Basalt
Basalt flattens forms as part of its forms tool, turning filled values into ordinary page content that cannot be edited or read back out of the form structure. It writes a new file every time, so your editable version stays as it was. When the requirement is removal rather than locking, the redact tool destroys content instead of covering it and a built-in verifier re-opens the written file with an independent parser to prove the content is gone. All of it runs in a sealed engine process with no network entitlement, enforced by macOS at the code-signature level, at $29 once for up to three Macs, free for 24 hours, at basaltformac.com.
Redaction that proves itself
Basalt destroys the content you mark, then re-opens the file it wrote and proves the content is gone before it saves anything. Your documents never leave your Mac.