PDFs Are Programs in a Trench Coat

Quick answer: A PDF is not just ink on digital paper. The format allows JavaScript, embedded files, launch actions and interactive annotations — features with legitimate uses that double as the standard hiding places for malicious content. Sanitizing strips those layers while keeping the document itself.

Most people meet PDFs as the safest-looking files in computing: documents, not programs. The format's specification disagrees. A PDF can run JavaScript when it opens. It can carry entire files inside itself. Its annotations can hold actions, attachments and links. Its forms can compute and submit. Every one of those capabilities exists for good reasons — and every one has been abused, because a file that arrives “just a document” gets opened with a trust programs never receive.

Sanitizing is the practice of demoting a PDF back to a document: keep the pages, remove the machinery. This tool does it structurally, in your browser, and counts what it finds — because “we removed 1 script, 2 attachments and 14 annotations” is information, while “your file is now safe” would be a claim nobody can honestly make.

What Gets Removed, Item by Item

Quick answer: The document's OpenAction and additional-actions entries, the JavaScript and EmbeddedFiles name trees, every page's annotations, the six metadata fields, and the XMP stream. Page content is never touched.
RemovedWhere it livesWhy it's a risk
Open / additional actionsCatalog /OpenAction and /AACode that fires the moment the file opens
Named JavaScriptNames dictionary → JavaScript name treeScripts callable by actions and events
Embedded filesNames dictionary → EmbeddedFiles name treeWhole files — including executables — hidden in a “document”
AnnotationsEach page's /Annots arrayPop-ups, links, file-attachment markers, form widgets — interactive objects with their own actions
MetadataInfo dictionary + catalog /Metadata (XMP)Names, tools and internal labels leak with the file

The removal is structural: entries are deleted from the document's dictionaries and the file is saved fresh, so the removed material isn't hidden or disabled — it's absent. The counts come from the file itself as it's cleaned: name-tree entries, annotation array sizes, metadata fields that were actually present.

How to Sanitize a File, Step by Step

Quick answer: Upload the PDF, click Sanitize PDF, read the counts in the result, and download the -sanitized.pdf copy. The original is never modified — keep it if the counts surprise you.

The counts are the step people skip, and they're the point. Zero across the board on a file from a trusted source is a shrug. Three attachments and a script in an “invoice” from a stranger is a story — one you may want to tell whoever sent it, or your IT department, before anyone opens the original. Because the original is untouched, sanitizing is also safe triage: clean first, examine the copy, escalate the original if the counts warrant it.

Under the result sits a share row. Copy Results puts a short text summary (the headline counts) on your clipboard; Share Link passes this page on; Email Results opens your mail app with the summary already written. Reset clears the file and the result, and it asks for confirmation first.

Why This Is Not an Antivirus — and What Is

An antivirus examines content: it pattern-matches byte sequences against known malware and analyses behaviour. Sanitizing examines structure: it removes the places active content legitimately lives. The two overlap — most commodity PDF malware uses exactly the script and attachment routes removed here — but they are not the same discipline, and the gap matters:

  • A maliciously crafted content stream exploiting a reader bug is not removed by structural cleaning.
  • A booby-trapped embedded font or image is content, not structure.
  • A perfectly clean structure can still wrap a document whose text is a phishing lure — no tool fixes persuasion.

The honest stack is layered: sanitize files from untrusted sources, open them in a current reader (reader updates close the exploit class), let your antivirus scan downloads as usual, and stay suspicious of urgency in any document. Sanitizing is the cheapest, fastest layer — not the only one.

Quick answer: Form fields are annotations, so sanitizing removes them — values stay visible where the field rendered an appearance, but the form is no longer fillable. Link annotations go too. Digital signatures do not survive any file edit, sanitizing included.

These are consequences to choose, not surprises to suffer. Distributing a filled form? Sanitize the outgoing copy and keep the fillable original. Publishing a document whose links matter? Links drawn as annotations will be removed — check the sanitized copy before it goes out. Signed document? Sanitizing invalidates verification, like every edit; sanitize before signing, never after. The tool's job is to make the safe copy; deciding which copy is the safe one stays with you.

Should I sanitize my own outgoing documents too?
It's a good habit for anything public: exports accumulate forgotten attachments, reviewer comments and metadata. The counts will show you your own toolchain's habits — often the most surprising reading of all.

Common Problems and How to Fix Them

Sanitizing is one click; its problems are about copies and expectations:

  • The form stopped working. Expected — fields were annotations and were removed. Use the original for filling; sanitize only the distribution copy.
  • Attachments I wanted are gone. Also by design. Extract them from the original first (your reader's attachments panel), then sanitize.
  • All counts are zero but I still don't trust the file. Correct instinct — read the antivirus section. Sanitizing is one layer; a zero count is not a certificate.
  • The upload failed. The file is likely password-protected or damaged — and a suspicious file you cannot open or clean should be deleted or escalated, not wrestled with.
  • The sanitized file still shows an author in our system. Your system may stamp or read copies differently — confirm you're looking at the -sanitized.pdf file's own Properties.

What This Tool Cannot Do

It cannot certify a file safe, scan content streams for exploits, or detect malicious intent in ordinary-looking content — it is not an antivirus. It cannot sanitize a file it cannot open (password-protected files need unlocking first, if you know the password). It cannot preserve form fillability, annotation links or signature validity — removing interactive objects is the treatment, and those are interactive objects. What it can do, it does completely: the documented active-content structures are deleted, counted and reported, in your browser, with the original preserved.

Your Files Never Leave Your Device

A suspicious file is the last thing to upload to a stranger's server — you'd be spreading the very thing you're trying to contain, and logging your documents in the process. This tool works the other way: the PDF library (pdf-lib) runs as a script inside your browser tab, your file is read from your device, and the sanitized PDF is assembled there too. Nothing is uploaded, nothing is stored, and there is no account holding a history of your documents. Close the tab and everything is gone — which also means you should save the sanitized file before you close it.

Sources & References

Sources checked November 2026.