Menu

A black box is not redaction — and three other things I got wrong building local PDF tools
📰

A black box is not redaction — and three other things I got wrong building local PDF tools

DEV Community: webdev·Felix ZHU·7 days ago
#1rm6jBp0
#devtowebdev#devto#dev#file#tool
Reading 0:00
15s threshold

Take any PDF. Draw a black rectangle over a line of text in a viewer that lets you annotate. Save it. Open it again and drag-select across the rectangle.

The text comes back.

That is the entire reason I built a PDF tool site, and it is also the first thing I got wrong.

A black box is a drawing, not a deletion

An annotation is an object layered on top of the page content. The characters underneath are still there, in the content stream, encoded exactly as they were before you covered them up. Select-all still finds them. Copy still copies them. Any text extractor still returns them.

Actual redaction means the characters stop existing in the file. Not hidden, not covered, not rendered white-on-white — gone from the content stream, so that extraction returns nothing.

I built the redaction tool around that distinction, and then I made the checker report a number instead of a picture.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.