How to Sanitize a PDF: Remove Hidden Data Before Sharing

The page looks fine. What you can't see is the problem: the reviewer's name in the metadata, the tracked-changes trail from the authoring tool, a spreadsheet somebody attached inside the file two versions ago, a script that runs on open. Here is what actually hides inside an everyday PDF, how to sanitize one free in your browser before it leaves the building — and why sanitizing and redaction are two different jobs that belong together.

What is actually hiding in a PDF

A PDF is a container, and containers accumulate. Four categories of invisible baggage travel with a typical business document:

  • Metadata and the XMP packet. Author and reviewer names, company details, the exact software and version that produced the file, creation and modification timestamps — the full provenance trail, readable by anyone who opens the document properties. Our PDF metadata guide covers what lives there in detail.
  • JavaScript and automatic actions. PDFs can carry document-level scripts and actions that fire on open, print, or save. Legitimate in forms and workflow documents — but nothing you want travelling in a file you publish, and many security-conscious recipients (and mail gateways) treat scripted PDFs with suspicion.
  • Embedded files and attachments. A PDF can contain entire other files — the source spreadsheet behind a chart, an email trail, an earlier draft. They ride along invisibly until someone opens the attachments panel. (Curious what a file is carrying? Our guide to embedded files shows how to look.)
  • Optional-content layers. Layers (OCGs) can hold content that is present in the file but switched off in the current view — alternate languages, un-toggled CAD detail, or an earlier state of the artwork. Hidden from sight is not gone: a reader can switch layers back on. More in our PDF layers guide.

None of this shows on the printed page, which is exactly why it slips through review after review — document-metadata leaks are a recurring, well-documented embarrassment in legal, government, and corporate publishing.

What sanitizing removes

Sanitizing strips the invisible categories above in one pass while leaving the visible page content untouched. With the free Sanitize PDF tool on the Mapsoft PDF Hub, each category is a checkbox, so you choose what goes:

  • Metadata & XMP — author, title, creator application, and the rest of the properties panel.
  • JavaScript & automatic actions — document-level scripts and open/print/save triggers.
  • Embedded files & attachments — every file travelling inside the PDF.
  • Optional-content layers — with one behaviour to know: removing layers makes all layer content permanently visible, so check layered documents after sanitizing.

How to sanitize a PDF online, free

  1. Open mapsoft.com/tools/Pdf/SanitizePdf and upload the PDF (drag-and-drop, file picker, or straight from cloud storage).
  2. Tick the categories to strip — for a file going outside the organisation, the usual answer is all four.
  3. Click Sanitize and download the cleaned file.

Sanitizing runs on our own UK servers — nothing is sent to a third-party service — and uploaded files are deleted automatically. The visible pages come back exactly as they went in.

In Adobe Acrobat Pro, the equivalent lives in the Redact tool set as Sanitize Document (with the more selective Remove Hidden Information alongside it) — a sensible route when you are already working in Acrobat; see our editions comparison for where these features live.

Sanitize or redact? You usually need both

The two get confused because both are about removing information — but they aim at opposite halves of the document:

  • Redaction removes what you can see: names, figures, account numbers, whole passages — permanently taken out of the page content. That is its own discipline, with the free Redact PDF tool online or Mapsoft's MaskIt plug-in for batch redaction inside Acrobat.
  • Sanitizing removes what you can't see: the metadata, scripts, attachments, and dormant layers described above.

A document cleared for release has had both: redact the visible secrets first, sanitize the invisible remainder second, and only then send. (Cropping, incidentally, does neither — as our cropping guide explains, content outside a crop is merely hidden.)

A pre-release checklist for outbound PDFs

  • Redact any sensitive visible content — properly, not with black rectangles drawn over live text.
  • Review comments and annotations — delete what shouldn't ship, then flatten the rest with Flatten Annotations so markup becomes fixed page content.
  • Sanitize — strip metadata, scripts, attachments, and layers in one pass.
  • Re-add the metadata you actually want — a public document may still deserve a proper title and copyright line; set them deliberately with metadata editing (or InfoSetter across many files).
  • Verify — run Analyze PDF on the outgoing file and confirm the properties, attachments, and structure show only what you intend.
  • Protect if appropriateencryption and permissions control who opens the file; they are the final wrapper, not a substitute for the steps above.

The document-hygiene toolkit, free on the PDF Hub

Sanitizing is one station in the clean-before-sending line, and the Mapsoft PDF Hub covers the rest in the same browser session, free:

  • Redact PDF — permanently remove sensitive visible content.
  • Flatten Annotations — bake reviewed markup into the page.
  • Edit Metadata — set the document properties you do want to publish.
  • Analyze PDF — inspect structure, fonts, and properties to verify the result.
  • Protect PDF — add encryption and permissions as the final step.

For files that go out on a schedule — reports, statements, published documents — the Hub's Workflow Builder chains these steps into a repeatable pipeline, and the same operations are available programmatically through the REST API.

Frequently asked questions

What does sanitizing a PDF remove?

Document metadata and the XMP packet, document-level JavaScript and automatic actions, embedded files and attachments, and optional-content layers — the invisible data, not the visible pages.

Will the document look different afterwards?

No — visible content is untouched. The one nuance: removing layers makes all layer content permanently visible, so check layered documents (CAD drawings, multilingual artwork) after sanitizing.

Is sanitizing the same as redaction?

No — redaction removes sensitive visible content; sanitizing removes the invisible remainder. A file cleared for release has usually had both, in that order.

Is my file private during sanitizing?

Yes — processing happens on our own servers with nothing sent to third-party services, and uploaded files are deleted automatically afterwards.

Does sanitizing remove comments?

Comments are visible content, so no — review them separately, delete what shouldn't ship, and flatten the rest with Flatten Annotations.

Should every outbound PDF be sanitized?

Anything leaving your organisation deserves at least a metadata strip — it costs seconds. Reserve judgement for files where the hidden data is the point, such as forms that need their scripts or portfolios that need their attachments.

Related Articles

PDF Redaction Done Properly

Permanently removing sensitive visible content — and why a black rectangle over live text fails.

How to Edit PDF Metadata

Viewing and setting document properties deliberately — title, author, keywords, and XMP.

PDF Security Explained

Encryption, permissions, and signatures — the protective wrapper around a cleaned document.

Sanitize a PDF Now

Upload a PDF, choose what to strip — metadata, scripts, attachments, layers — and download the cleaned file in seconds. Free, from any browser.