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

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

说明与用途

在浏览器中使用 pdf.js 渲染页面到 canvas,绘制黑色遮罩,转换为 PNG 并用 pdf-lib 重新生成 PDF,彻底删除原始文本和增量修订,确保信息安全。

问题

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.

结果

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.

工作流

  • 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.

证据

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

来源

The only approach that reliably satisfies all three is rasterization.

来源

  • 记录日期: 2026-09-15T13:15:19.945Z