Publishing a PDF isn’t the same as publishing an image. PDFs can quietly carry hidden data and active features—from author names and revision history to embedded scripts and attachments. That extra baggage can create privacy, security, and compliance risks. This post explains what’s commonly buried in PDFs, why it matters, and practical ways to audit and sanitize files before they go live.
What’s “hidden” inside a PDF?
Not everything in a PDF is visible on the page. The format is a container with pages, objects, and dictionaries that can store lots of extra data. Below are common categories, what they look like in the wild, and why you should care.
1) Metadata (XMP / Document Info)
PDFs carry document properties such as Title, Author, Subject, Keywords, and a full XMP packet that can include software names, usernames, timestamps, version numbers, and even GPS/location (rare but possible when documents originate from photos or map exports). Example: A proposal PDF listing Author: jdoe-legal and Creator: Acme_Internal_Template_v3.indd—revealing internal usernames and tooling.
2) Revision residue & hidden objects
During export or incremental saves, previous objects or alternate images can linger. You won’t see them on screen, but they remain addressable in the file. Example: An earlier draft logo remains embedded as an “alternate image,” or a stale page object still references an internal filename.
3) Annotations & comments
Sticky notes, highlights, drawing markups, and review comments often persist unless explicitly removed. Layers (OCGs) and form fields also qualify as “interactive” content. Example: A board packet still contains comment balloons like “Let’s soften pricing on slide 7.”
4) Embedded files & attachments
PDFs can carry other files—spreadsheets, scripts, or even other PDFs—inside the container. Many viewers hide these behind an “Attachments” panel. Example: A handout PDF that quietly includes an attached pricing.xlsx.
5) Active content & actions
JavaScript and action dictionaries can trigger on open, on page view, or when clicking annotations. Common keys include /JavaScript, /JS, /OpenAction, and /AA (Additional Actions). Example: A click-through area runs app.launchURL(...) or a document tries to execute code at open.
6) Links & external references
Hyperlinks (URL and mailto), embedded media URLs, and image references can point readers to external domains. Example: A link to a staging site or a private SharePoint URL that should never be exposed externally.
7) Hidden text & OCR artifacts
OCR and layout tools can generate invisible text layers (used for searchability) or put white text under black rectangles. Example: A “redacted” number is merely covered by a shape—the underlying text still extracts or copies.
8) Accessibility & structure tags
Tagged PDFs carry reading order and structure trees. That’s usually good for accessibility and compliance, but tags and the XMP packet can expose workflow details. Example: A tag tree naming a proprietary template or house style.
Risks: why this matters
Below we expand each risk with a real example—who, what, when, and where—plus the takeaway for publishers.
Privacy & compliance
Example (public records & metadata): Lake v. City of Phoenix (Arizona Supreme Court, Oct 30, 2009, Phoenix, AZ). The court held that electronic metadata is part of the public record, meaning agencies may be required to disclose it under state law. Practically, if you publish a PDF without scrubbing properties or XMP, you can expose usernames, edit history, or system paths in response to records requests. Takeaway: treat metadata as disclosable content and sanitize before release. [1]
Information leakage (failed redactions)
Example A (U.S. federal court filing): On Jan 8, 2019 in Washington, D.C., former Trump campaign chairman Paul Manafort’s legal team filed a PDF with “blacked‑out” passages that could be revealed via copy‑paste, exposing details such as alleged sharing of polling data with Konstantin Kilimnik. Newsrooms uncovered the text within minutes. Takeaway: cosmetic redaction isn’t redaction; you must remove content from the file structure. [2][3]
Example B (UK government): In April 2011, the UK Ministry of Defence published a redacted nuclear‑submarine safety report online. Because the redaction was done improperly, the hidden text was recoverable, revealing sensitive technical information and causing a public outcry. Takeaway: redaction errors are public, permanent, and reputationally costly. [4][5]
Phishing & malvertising risk (active content & attachments)
Example (recent campaigns): Security telemetry reports show attackers routinely ship malicious PDFs or files masquerading as PDFs that execute JavaScript or redirect to credential‑harvesting sites. In 2023–2024, providers reported persistent waves of PDF‑borne phishing; in Sept 2024–Oct 2025, Microsoft detailed a campaign using AI‑generated code and attachments disguised as PDFs to lure victims to fake login pages. Takeaway: eliminate active content in outbound PDFs and be wary of inbound PDFs; expect aggressive email filtering. [6][7][8]
Operational friction (false positives and delivery issues)
Example (enterprise email): Microsoft documents ongoing cases where legitimate emails are quarantined as false positives—including because of attachments—requiring admins to submit samples and adjust policies. For consumer and EDU tenants, Gmail also blocks or restricts certain attachment types and will disable downloads it deems risky. Takeaway: even clean PDFs can get caught by heuristics; sanitation reduces noise and speeds approvals. [9][10]
Authenticity & trust (recipient skepticism & deliverability)
Example (marketing deliverability): Deliverability specialists caution that bulk mail with attachments—especially PDFs—can depress inbox placement and trigger spam heuristics. Reputable programs advise linking to hosted content instead, and only attaching sanitized PDFs when necessary. Takeaway: attachments change how your message is scored; minimize, and sanitize when you must attach. [11]
How common authoring tools handle export & sanitization
Canva. Canva is superb for layout, but it does not provide a one‑click PDF sanitization feature. You can remove hyperlinks in your design before export, and you can export as PDF Print for quality, but to strip annotations, JavaScript, and hidden objects, run the exported file through an external sanitizer (Acrobat Sanitize, Ghostscript, qpdf, or mutool clean).
Adobe InDesign. InDesign exports high‑fidelity PDFs with layers, links, and structure tags. It does not “sanitize” on export. Best practice: export to PDF/X or PDF/A when possible, then open in Acrobat Pro and apply Remove Hidden Information or Sanitize Document, or run a Preflight fixup (Flatten annotations; Remove JavaScript). For workflows at scale, add a Ghostscript/qpdf pass in CI.
Microsoft Word (and Office apps). Word can embed document properties, comments, and tracked changes if not accepted. Before export: File → Info → Check for Issues → Inspect Document to remove properties/comments, then Save as PDF. For sensitive releases, still run an external sanitizer.
Google Docs. Docs strips most revision history on export, but document properties and links remain. Use File → Download → PDF and then an external pass (Acrobat Sanitize or CLI tools) for consistent results.
Apple Pages/Keynote/Numbers. Exports include metadata and links; sanitization is not automatic. Use File → Reduce File Size only for size—not security. Follow with Acrobat/CLI sanitation.
LaTeX toolchains. pdflatex/xelatex produce PDFs with minimal active content by default, but author/title, keywords, and embedded fonts persist; packages can add annotations and links (e.g., hyperref). Strip metadata with exiftool, normalize with qpdf, or produce PDF/A via pdfx and then sanitize.
Redaction (special case)
Never rely on black rectangles or white boxes to hide text—those only cover content visually. True redaction removes the underlying text/objects from the PDF structure.
- Adobe Acrobat Pro: Tools → Redact → Mark for Redaction → Apply → (optionally) Sanitize Document to strip residual artifacts.
- pdf-redact-tools (Linux): Safest for highly sensitive work; rasterizes pages, applies redaction mask, and re-encodes, preventing text recovery.
- Preflight hard‑flatten (Acrobat): Tools → Print Production → Preflight → Fixups: Flatten annotations and form fields, then re-check with Remove Hidden Information.
Tip: After redaction, test by attempting to copy/paste, run pdfid.py, and search text extracts to confirm removal.
Sanitizing a PDF: levels of cleaning
Choose the lightest method that achieves your goal. Always work on a copy and preserve the original in a restricted location.
Level 1 — Clean metadata & hidden info (preserve links)
Why: You want to remove personally identifiable authorship and obvious residue, but keep navigation and accessibility intact.
How:
- Adobe Acrobat Pro: Tools → Redact → Remove Hidden Information and select items to purge (metadata, hidden text, file attachments). Leave Links unchecked to preserve URLs.
- Command line:
12345# Clear common metadata fields (XMP + Info)exiftool -all= -overwrite_original_in_place file.pdf# Verify what remainspdfinfo file.pdf && exiftool file.pdf
Result: Document properties are scrubbed; visible content remains unchanged.
Level 2 — Remove actions/JavaScript; flatten annotations
Why: You need to eliminate scripts and interactive elements that can leak data or trigger security tools, while keeping fidelity.
How:
- Acrobat Pro (Optimized PDF): File → Save as Other → Optimized PDF… → Discard Objects: Discard all JavaScript actions, optionally Flatten form fields, remove alternate images. Clean Up: remove private data.
- Acrobat Preflight: Tools → Print Production → Preflight → Fixups: Flatten annotations and form fields, Remove all JavaScripts.
- CLI options:
123456# Normalize structure (lightweight)qpdf --linearize --object-streams=disable input.pdf output.cleaned.pdf# Remove annotations and JS aggressively (MuPDF)mutool clean -a -d input.pdf output.cleaned.pdf
Result: Links may remain (depending on options), but JavaScript and most interactive artifacts are gone.
Level 3 — Hard flatten / rewrite (most thorough)
Why: High‑risk releases, or when prior steps still trip endpoint protection.
How:
- Acrobat / OS Print: File → Print → Adobe PDF (or system Print to PDF). This re‑renders each page.
- Ghostscript (batch‑friendly):
123gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \-dPDFSETTINGS=/printer -sOutputFile=output.sanitized.pdf input.pdf
Result: Interactivity and hyperlinks are removed; pages are effectively flattened. Re‑check accessibility if that’s a requirement.
Sysadmin playbook: auditing and batch-sanitizing at scale
Quick audit checklist (with examples)
- Active content present?
pdfid.py file.pdf→ flags for/JavaScript,/OpenAction,/AA. IfJavaScript: 1, treat as risky.
- Attachments embedded?
mutool info file.pdforqpdf --show-object=all file.pdf | grep -i EmbeddedFileto reveal hidden attachments likepricing.xlsx.
- Unexpected metadata?
exiftool file.pdf→ look forAuthor,Creator,Producer,History.
- Annotations/layers?
- In Acrobat, open Comments/Layers; or use
mutool show file.pdf trailerto look for/Annotsand/OCG.
- In Acrobat, open Comments/Layers; or use
Recursively audit a site/webroot (example)
|
1 2 3 4 5 6 7 8 9 10 11 12 |
#!/usr/bin/env bash set -euo pipefail ROOT=${1:-/var/www/html} find "$ROOT" -type f -iname '*.pdf' | while read -r f; do js=$(pdfid.py "$f" | awk '/JavaScript/ {print $NF}') aa=$(pdfid.py "$f" | awk '/AA/ {print $NF}') emb=$(qpdf --show-object=all "$f" 2>/dev/null | grep -ci EmbeddedFile || true) meta=$(exiftool -s -s -s -Author -Creator -Producer "$f" 2>/dev/null | tr ' ' '; ') echo "$f|js:$js|aa:$aa|emb:$emb|$meta" done |
Batch sanitize (safe default)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#!/usr/bin/env bash set -euo pipefail INROOT=${1:-/var/www/html} OUTROOT=${2:-/var/www/pdf-sanitized} mkdir -p "$OUTROOT" find "$INROOT" -type f -iname '*.pdf' | while read -r f; do rel=${f#$INROOT/} outdir="$OUTROOT/$(dirname "$rel")" mkdir -p "$outdir" gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \ -dPDFSETTINGS=/printer -sColorConversionStrategy=UseDeviceIndependentColor \ -sOutputFile="$outdir/$(basename "$f" .pdf).sanitized.pdf" "$f" exiftool -all= -overwrite_original_in_place "$outdir/$(basename "$f" .pdf).sanitized.pdf" >/dev/null done |
CI/CD integration ideas
- Add a pre‑publish job: sanitize → run
pdfid.py,qpdf --check, and an AV scanner → block release if active content persists. - Optionally convert public copies to PDF/A‑2b for long‑term archiving and fewer active features (verify rendering & accessibility).
Tooling quick reference
Inspect / audit
- Adobe Acrobat Pro (Remove Hidden Information, Sanitize Document),
pdfinfo,exiftool(metadata),qpdf --check,pdfid.py,mutool info.
Sanitize / transform
- Ghostscript (hard flatten), qpdf (normalize/object‑stream control), **MuPDF **
mutool clean(drop JS/annotations with flags), pdfcpu (Go CLI/API for removing attachments/annotations), pikepdf (Python library atop qpdf for scripted sanitizers).
Automate
- GitHub Actions, GitLab CI, or Jenkins stages calling Docker images that bundle Ghostscript+qpdf+exiftool. Publish only artifacts that pass checks.
Closing thought
Good PDF hygiene isn’t busywork—it’s risk reduction. A lightweight, automated sanitation step can prevent accidental data leakage, reduce malware false positives, and build trust with recipients. If you’d like help setting up a pre-publish sanitizer or a site-wide audit, Reliable Penguin can get you there.
Footnotes
[1] Wired, “Metadata in State Documents Is Public Record” (Arizona Supreme Court, Lake v. City of Phoenix, Oct 30, 2009). https://www.wired.com/2009/10/metadata
[2] CBS News, “Manafort filing reveals alleged campaign communications with Russian operative” (Jan 8, 2019). https://www.cbsnews.com/news/manafort-filing-reveals-alleged-campaign-communications-with-russian-operative/
[3] BBC News, “Failed redaction reveals Paul Manafort’s ‘lies to FBI’” (Jan 8, 2019). https://www.bbc.co.uk/news/world-us-canada-46804127
[4] The Register, “Redaction FAIL: nuke sub document revealed in full” (Apr 18, 2011). https://www.theregister.com/2011/04/18/dnsr_report_declassified_not_redacted/
[5] TIME, “Wanna Know UK Nuclear Sub Secrets? Just Ask For The Redacted Version” (Apr 18, 2011). https://time.com/archive/7241626/uk-military-sub-secrets/
[6] Cloudflare, “2023 Phishing Threats Report” (May 2022–May 2023). https://blog.cloudflare.com/2023-phishing-report/
[7] Zscaler ThreatLabz, “Phishing Report 2024” (Sept 2024). https://zerotrust.cio.com/wp-content/uploads/sites/64/2024/09/threatlabz-phishing-report-2024.pdf
[8] TechRadar Pro, “Microsoft blocks phishing scam that used AI‑generated code to trick users” (Oct 2025). https://www.techradar.com/pro/microsoft-blocks-phishing-scam-that-used-ai-generated-code-to-trick-users
[9] Microsoft Learn, “Handle legitimate emails getting blocked (False Positive) – Defender for Office 365” (2025). https://learn.microsoft.com/en-us/defender-office-365/step-by-step-guides/how-to-handle-false-positives-in-microsoft-defender-for-office-365
[10] Google Help, “File types blocked in Gmail” (2025). https://support.google.com/mail/answer/6590
[11] Mailforge, “How Attachments Impact Email Deliverability” (Sept 2025). https://www.mailforge.ai/blog/how-attachments-impact-email-deliverability




