Flatten PDF

Published Updated

Lock all interactive form fields into permanent, static page content, then download the result — free, private, and processed entirely in your browser.

Flatten PDF handles form fields, nothing else

This tool takes the fillable fields of a PDF and fixes them into the page. For every field that is not hidden it draws the field's current appearance into the page content. It deletes every field and its annotation, hidden ones included. The result looks the same and cannot be filled in again.

In the PDF specification, a field's look is stored as an appearance stream on its widget annotation (ISO 32000-1, sections 12.5 and 12.7). The tool reuses that stored look. It does not re-render the page, and it makes a new appearance only for a field that has none.

What changes inside the file

For each field, the tool appends a few drawing commands to the page: save the graphics state, move to the field's rectangle, paint the field's stored appearance as a reusable object, restore the state. Then it deletes the field and its widget. The library the page uses, pdf-lib, describes this as making each appearance part of the page's content stream (pdf-lib documentation). The tool also takes each deleted widget out of the page's list of annotations, including the separate widgets of a radio group, so that no entry in the list points at an object that no longer exists. A last step removes objects that nothing points to any more, such as the old field dictionaries, and saves the file.

The change reaches the text layer too. In the test below, none of the typed values could be found in the page text of the original, because they lived in widget annotations. After flattening they were part of the page.

Before and after

ElementAfter flattening
Text fields, drop-downsFixed text, no longer editable
Checkboxes and radio buttonsA fixed tick or dot when on, their empty look when off
Digital signature fieldsAppearance kept, signature no longer valid. An empty one with no appearance is deleted and nothing is drawn
Fields with the Hidden flagNot drawn, deleted with the other fields
Comments, highlights, stampsUnchanged, still annotations
LinksUnchanged
Page textUnchanged and selectable

Worked example: a 13-field test form

Measured with the page's own flatten code in Node (pdf-lib 1.17.1 plus the tool's extra steps, then the same unreferenced-object cleanup and save) on a one-page A4 form made with ReportLab 5.0.0: eight text boxes, two checkboxes, a three-option radio group, a drop-down, a three-line notes box, one web link and ordinary text. All fields were filled in. Page text was read with pdf.js 5.4.624.

MeasureOriginalFlattened
Form fields130
Widget annotations on the page150
Link annotations11
Annotation entries that point at a deleted object00
Field values found in the page text0 of 1212 of 12
Page content stream, decoded2,158 bytesabout 3,340 bytes
Objects in the file5836
File size19,293 bytesabout 8,850 bytes

The file shrank, but flattening is not the main reason. Opening the original and saving it again with pdf-lib, with no flattening, already gave about 12,300 bytes, so about 7 KB of the 10.4 KB saved came from the rewrite alone. The page content grew by about 1.2 KB, which is the 15 drawing blocks. The last digits of the sizes change by a few bytes between runs because the tool names each drawn object with a random number. A form made by another program will give other numbers.

Edge cases found in testing

A field marked hidden is left out. The PDF specification says a hidden annotation is not to be displayed or printed (ISO 32000-1, section 12.5.3), and the tool follows it: a widget whose Hidden flag is set, on the widget itself or on its field, is not drawn, and its field is deleted like the others. In a test file with one hidden text field and one normal one, only the normal one was drawn, and the hidden value was not found anywhere in the saved file. Only the Hidden flag counts. A field marked as not shown on screen but printable (the NoView flag) is still drawn.

An unsigned signature field with no stored appearance has nothing to draw, so the tool deletes it and draws nothing. The rest of the form flattens as usual. A text value outside the Latin set, such as Hebrew, stops the run when its field has no appearance (the library reports "WinAnsi cannot encode"). Accented Latin text such as "Café ñ" in the same situation worked. For the Hebrew case the tool shows its general error message.

The tool flattens every field in the file, with no way to choose fields or pages. For what other rewrites keep and drop, including form fields and signatures, see the guide Compress, merge and convert PDFs without uploading them.

Flatten a form in three steps

  1. Step 1

    Add the filled-in PDF

    Save your entries in the PDF first, then add that saved file. The page reads the page count and checks the file is not password protected.

  2. Step 2

    Press Flatten PDF

    Each form field that is not hidden is drawn into the page as it currently looks. Every field, hidden or not, is then deleted from the file.

  3. Step 3

    Download the -flattened.pdf

    Open it and try to click a field. Nothing should respond, and the text should still be selectable.

When flattening fails

A field normally carries its own appearance, so the tool has nothing to build. If a field has none, one is generated in Helvetica, which covers Latin characters only (an empty signature field is the exception: it is deleted and nothing is generated). A value in Hebrew, Arabic, Chinese or another script in such a field makes the run fail. Pure XFA forms, an older Adobe LiveCycle technology, store their fields as XML instead of standard form fields, and this tool does not read them. The run finishes without an error, no field is flattened, and the XFA data is removed from the file.

Encrypted PDFs stop at the start with a message pointing you to Unlock PDF.

What to use if you need more than the fields

To make text unrecoverable, use Redact PDF, which renders each page as an image. Flattening keeps the text of your page, so it is not a privacy tool. To limit who can open or edit the file, add a password with Protect PDF.

Flattening a PDF, answered

Does flattening also flatten comments, highlights and stamps?

No. The tool flattens form fields only: text boxes, checkboxes, radio buttons, drop-downs and the like. Sticky notes, highlights, drawings and stamps are a different kind of annotation and stay as they were.

Is the text still searchable afterwards?

Yes. Flattening does not turn pages into pictures. The page text is untouched, and field values become ordinary drawn content, so most can still be selected and copied.

Does flattening stop people editing the PDF?

It removes the fillable fields, which stops casual changes to the entries. Anyone with a PDF editor can still alter the page content. For access control use a password with Protect PDF.

Why did flattening fail with an error?

The common causes are a password-protected file (remove the password first), a field with no stored appearance that contains characters outside the Latin set, or a damaged file. The tool shows a general message in each case.

What happens to a digital signature?

The file is rewritten, so a cryptographic signature on the original is no longer valid. Flatten a copy and keep the signed original.

I filled the form in my browser. Why are the fields empty?

Values only flatten if they are saved in the file. Use Save or Print to PDF in the viewer first, then add the saved file here.

Will flattening make my PDF smaller?

Not by itself. In a 13-field test form the page content grew by about 1.2 KB for the 15 drawn fields. The file still came out about 10 KB smaller, because the tool also removes unused objects and writes the file again, and the rewrite alone accounted for about 7 KB of that. A form that is already compact may end up the same size or slightly bigger.

What happens to a field I hid?

It is left out. A field whose Hidden flag is set is not drawn, and the field is deleted with all the others, so it does not show up in the flattened file. Only that flag counts: a field marked as not shown on screen (the NoView flag) is still drawn, and so is a field that is only covered by other page content.

Can I flatten only some of the fields or pages?

No. The tool flattens all form fields in the whole file in one go, and it does not offer a field or page picker. If part of a form must stay fillable, flatten a copy and keep the original file.

Related guide

How to flatten, resize and shrink a PDF. The guide separates form flattening from transparency and from drawing pages as pictures, and shows a test form going from 4 fields to 0 with a size change of about 0.07% (measured before the November 14 flatten update).

Related Tools