Dev.to
7/15/2026

A Black Box Drawn Over a PDF Isn't Redaction — Here's How I Fixed It Client-Side
Short summary
Drawing a black box over PDF text doesn't remove it — the text remains selectable and copyable underneath. The author solves this client-side by rasterizing only pages with redactions at 3x scale, burning annotations into the same bitmap, while leaving all other pages as lightweight vector content. The approach uses PDF.js canvas rendering with percentage-anchored HTML overlays and a per-page render token to prevent async race conditions during resizing.
- •Black boxes over PDF text are not real redaction — text stays extractable
- •Solution: rasterize only redacted pages at 3x, keep others as vector
- •Per-page render tokens prevent async canvas race conditions
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



