Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

You Don't Need Acrobat to Redact a PDF: A Browser‑Native Pipeline Using pdf.js and pdf-lib

Description and use

A browser‑native PDF redaction pipeline that renders pages to canvas, draws black boxes, flattens to PNG, and rebuilds a new PDF with pdf-lib, ensuring no hidden text or incremental revisions remain.

Problem

Redaction tools that only overlay black boxes on PDFs fail to remove the underlying text and can leave hidden data from incremental updates, making sensitive information recoverable.

Outcome

The pipeline produces a PDF where sensitive text is irrecoverably removed, with no traces of original content or incremental revisions, and the process runs entirely client‑side in the browser.

Workflow

  • 1. Read PDF as ArrayBuffer in browser; parse with pdf.js.
  • 2. Render each page to an HTML canvas at desired resolution.
  • 3. Draw user‑selected redaction shapes directly onto the same canvas using 2D context.
  • 4. Convert the canvas to a PNG data URL, flattening all content.
  • 5. Create a fresh PDFDocument with pdf-lib and embed each PNG as a page image.
  • 6. Save the new PDF, discarding the original file entirely.

Evidence

A black rectangle sitting on top of that structure does not delete anything. It just draws over it.

Source

The only approach that reliably satisfies all three is rasterization.

Source

  • Record date: 2026-09-15T13:15:19.945Z