High-profile court filings and FOIA releases still fail every year for the same reason: someone opened a PDF editor, drew opaque black rectangles over names or SSNs, saved the file, and emailed it out.
Anyone who presses Ctrl+A and Ctrl+C (or runs pdftotext) still extracts every word underneath those boxes — along with Author, Creator, XMP history, and annotation layers.
What forensic-grade offline redaction actually requires
- True pixel burn-in (150–300 DPI): Render each page onto an HTML5 Canvas, paint solid black over the selected bounding boxes so the original glyphs never exist in the pixel buffer, and rebuild a clean PDF from the flattened raster pages.
-
Metadata & EXIF stripping: Clear
Infodictionary entries (Author,Title,Creator,Producer), drop XMP streams,AcroFormfields, bookmarks, and annotations — and strip EXIF GPS/device headers when importing scanned photos (PNG/JPG/WebP). -
Automated second-pass + Re-OCR verification: Re-open the generated PDF bytes in a fresh parser pass (
VERIFIED · 0 Leaked Text) and run Re-OCR Verify Output using self-hosted in-browser LSTM WASM OCR (tesseract.js+ same-origineng.traineddata.gz) to prove zero sensitive targets survive even in the flattened pixels.
Try it offline in your browser (zero uploads)
- VeilPress Offline PDF Redaction Studio: lukaslabs.top/veilpress/app (works offline as a PWA, supports scanned PDFs & photos, includes a built-in 3-page Sample Confidential PDF)
- Guide: Why Black Boxes Fail PDF Redaction Audits
(Disclosure: Built independently at Lukas Labs.)
Update (2026-12-03): Raw Byte / Hex Stream & Incremental %%EOF Revision Verification
Great point from @kamalmosadegh in the comments below: auditing the finished output bytes directly (not just trusting the rasterization pipeline) catches incremental-update tails and hex-encoded PDF strings that a simple text-layer check can miss.
We just shipped two updates based directly on that feedback:
-
Upgraded VeilPress's local post-redaction verifier to also grep raw output PDF bytes and inflated
FlateDecodestreams (plain ASCII, PDF<hex>, and UTF-16BE hex), verify exactly1%%EOFrevision trailer (proving zero incremental-update tail survived), and assert0selectable text chars on full-raster rebuilds. -
Open-sourced a standalone MIT PDF Redaction Leak Checker (zero-dependency browser tool + Python 3 CLI
audit_pdf_redaction.pyfor CI/terminal verification):- Live offline checker (1-click leaking PDF demo): https://lukaslabs.top/tools/pdf-redaction-checker
- MIT repo & Python CLI: https://github.com/oneguo-boop/pdf-redaction-leak-checker
Top comments (7)
Good write-up — the failure mode is real, and burn-in plus re-OCR is the right shape. One check I'd add before calling a file clean: verify the output file itself, not just the process. Grep the raw bytes of the finished PDF for the redacted string — and in hex form too, since PDF strings can be hex-encoded — after expanding it with
qpdf --qdf, and check every revision, not just the latest one. An incremental-update tail can keep the original text alive in an older revision even when the current one is clean, and that's the leak a 'verify the pixels' pass never sees, because the pixels were never the problem — the file was. A second, cheaper gate:pdftotexton the output should return nothing at all. If any text survives a raster rebuild, the raster path leaked somewhere.Spot on — thank you for calling that out. We actually shipped your exact checks in VeilPress v1.1.1 this morning:
FlateDecodestream in the finished output bytes and greps both raw and inflated streams for redacted tokens across ASCII, PDF<hex>strings, and UTF-16BE hex.%%EOFtrailers in the final bytes and fails verification if more than 1 exists (so older incremental revisions can't keep pre-redaction text alive).audit_pdf_redaction.py, works standalone or alongsideqpdf --qdf) so anyone can run the byte/hex/%%EOFaudit independently: github.com/oneguo-boop/pdf-redacti...Really appreciate the review — that revision + hex-string edge case is exactly the kind of blind spot that makes "trust the UI" redaction dangerous.
That's exactly the right shape — and the UTF-16BE hex coverage is the part most tools skip, so good catch there. One gap worth testing: a token split across hex-string segments, or rendered through a subset font with a custom encoding, won't match a hex grep even after inflation — that's the case the pdftotext-empty gate was for. Do you run that gate too, or does the FlateDecode audit cover it in practice?
Yes — VeilPress runs that exact zero-text-layer gate too:
runForensicAudit): Right after rebuilding the finished PDF from burned raster pages into a freshPDFDocument.create(), it re-opens the output bytes withpdfjs-dist(page.getTextContent()), which resolves subset fonts, custom encodings,ToUnicodeCMaps, and splitTJruns — the browser equivalent ofpdftotext. In default full-document raster mode,outputTextChars === 0is a hard pass gate (passedfails if any selectable text survives, even if a raw/hex grep missed it). Inredacted-onlymode, redacted pages are rebuilt strictly as image-only pages whilepdfjs-disttext extraction checks all redacted targets (plus whitespace/hyphen-compacted forms) alongside theFlateDecodebyte grep.audit_pdf_redaction.py): Because it intentionally has zeropoppler/pdfiumdependencies, it scans raw/inflatedTj/TJoperators rather than decoding custom font CMaps. On a fully rasterized file,extracted_text_chars == 0still catches surviving text operators, but for arbitrary third-party PDFs with custom subset-font encodings, pairing it withpdftotext out.pdf -(must be empty) is definitely still the cleanest independent double-check.Thanks again for calling out the split-hex / custom-encoding case — keeping the boundary clear between CMap-decoded text extraction and raw stream greps is huge.
Thanks — that's the boundary stated exactly right. The pdfjs-dist gate is the CMap-decoded layer, and the stdlib CLI's raw-stream grep is the other layer; neither replaces the other. The pdftotext-empty check is the cleanest independent double-check for the CLI case — worth documenting as the required second check rather than an optional one, since that's what catches the custom-encoding file the grep can't see.
That's exactly the boundary I was hoping for — CMap-decoded extraction as the gate, raw stream grep as the fallback, never the other way round. And the honest caveat on the stdlib CLI is the part that matters most: it knows it can't decode custom encodings, so it doesn't pretend a hex grep is a verdict. pdftotext empty as the independent double-check is the right call — two different mechanisms agreeing is what turns 'clean' from a hope into a claim.