Sanitize or flatten a PDF: remove hidden content or fix what is visible
Before a PDF leaves your hands, two kinds of clean-up are common, and they are easily mixed up. One removes things that are not visible on the page but travel inside the file, such as scripts, metadata and embedded files. The other takes things that are visible but still editable, such as form answers, comments and highlights, and makes them a permanent part of the page. A file can need one, the other, or both, and doing the wrong one leaves the real problem in place.
At a glance
| Aspect | Sanitize | Flatten |
|---|---|---|
| What it targets | Hidden content: scripts, metadata, embedded files and form fields. | Visible content that can still be edited: form fields, comments, highlights and stamps. |
| What the reader sees | The same pages, as they were. | The same pages, with the answers and marks now fixed. |
| Can the content be edited afterwards | The visible text is unchanged and is edited as before. | Form answers and marks can no longer be edited or hidden. |
| Typical reason | Publishing a file without leftover author data or hidden parts. | Sending a filled form that nobody should be able to change. |
| What stays behind | Anything visible on the page. | Hidden content such as metadata, unless it is removed separately. |
Decide by what you want to get rid of
If your worry is what the file carries without showing it, such as an author name, an old comment trail or an attached document, sanitize it. If your worry is that someone could change the answers or remove a highlight, flatten it. When a filled form will also be published, do both, and keep the original so you can start again if you made a mistake. Always open the result and look through it before you send it.
When to choose which
Sanitize
Choose sanitizing when you want to remove hidden content before sharing or publishing a file.
Flatten
Choose flattening when you want filled answers and marks to stay fixed on the page.
Free tools for both options
Guides that put it into practice
- Clean a PDF before publishingStep by step: remove scripts and embedded files, strip hidden metadata, sanitize the document and check the result before you post a PDF on your site or send it widely.
- Submit a filled form that cannot be changedStep by step: fill in the fields of a PDF form, flatten it so the answers become part of the page and compress it to fit the size limit of an upload portal.
PDF terms explained
- PDF sanitizationSanitizing a PDF removes hidden content such as scripts, metadata, attachments and form fields while keeping the visible pages. Learn what it removes and when to use it.
- PDF flatteningFlattening merges form fields, comments or layers into the page so they can no longer change. Learn when it helps and what you lose.
- PDF form fields (AcroForm)Fillable PDF forms use AcroForm fields: text boxes, checkboxes, lists and radio buttons. Learn how fields store answers and how to fill, list or export them.
Common questions
- Does flattening remove metadata?
- No. It makes visible content permanent, but properties such as the author and dates stay in the file unless you sanitize it or remove them separately.
- Does sanitizing keep the form fields?
- No. Sanitizing removes form fields, so use flattening first if you want the answers to stay visible on the page.
- Which of your tools handle this?
- Sanitize PDF removes scripts, metadata, embedded files and form fields while keeping the visible pages, Flatten PDF merges form fields, comments, highlights and stamps into the page, and Flatten PDF form does this for a filled form. Each tool saves a new file and leaves your original as it was.