All tools › Guides › Why black boxes do not redact, and what actually removes text from a PDF

Why black boxes do not redact, and what actually removes text from a PDF

Redaction failures make the news every few months, and they are nearly always the same mistake made by someone careful. The mechanism is worth understanding once.

By Morn Tithsinara · Updated

A page is a list of instructions, and a black box is one more instruction

A PDF page is not an image. It is a content stream — an ordered list of drawing instructions that a reader executes from top to bottom. "Set this font at eleven point. Move to this coordinate. Show these glyphs." Whatever the page ends up looking like, every element that produced it is still in the file, in order.

When you draw a black rectangle over a name in a general-purpose PDF editor, you append one more instruction to that list: fill this rectangle with black. You have not removed the earlier instruction that draws the name. You have drawn something on top of it. The name is still in the content stream, in full, at its original coordinates.

Everything follows from that. Select the region and copy — you get the name, because the text extractor reads the instructions, not the picture. Run any text-extraction tool over the page and it comes straight out. Open the file in an editor that lets you delete objects and the rectangle lifts off like a sticker. The document looks redacted and is not, and it will keep looking redacted right up until somebody checks.

What real redaction has to do instead

To genuinely remove text, the instruction that draws it has to stop existing. There are two ways to arrange that, and both amount to rebuilding the page rather than annotating it.

One is surgical: parse the content stream, find the specific text-showing operators that fall inside the marked region, delete them, and rewrite the stream. This preserves the rest of the page as vector content, and it is fiddly — text runs do not respect rectangle boundaries, so a run that is half inside the box has to be split, and the surviving half re-positioned.

The other is to re-render. Redact PDF takes this route: each page carrying a box is rendered as an image 1600 pixels across — about 190 dpi on an A4 page, less on a larger one — the black boxes are painted onto that image, and the image becomes the page. The text you covered is not hidden underneath it. It was never written into the new page at all, because the new page contains one instruction: draw this picture.

The cost is confined to the pages you marked. Their text stops being selectable and searchable, any links or form fields on them are gone, and they get heavier. Pages you did not mark are copied across untouched and keep their vector text. The document is also assembled fresh, so the original's bookmarks and metadata do not come across — which, for a redaction, is the right default rather than a limitation.

The copies you did not think of

The mechanism is only half the problem. The other half is that a box removes what is under it, on that page, and nothing else — and the thing you are removing is almost never in only one place.

A name being redacted from a witness statement is also in the running header on every page, in the table of contents, in a footnote on page 4, in the properties panel as the document author, and spelled slightly differently in an appendix. Drawing one box does not find the others. There is no substitute for reading every page before you apply.

Metadata deserves its own sentence. Document title, author, subject and keywords are stored above the pages and are visible in any reader's properties dialogue. Because Redact PDF assembles a fresh document, those fields do not carry across — but if you redact by any other means, check them, because a file whose pages are immaculate and whose author field names the person you redacted has not achieved anything.

Three things that look like redaction and are not

  • Highlighting in black. A highlight is an annotation. It sits above the page in the file structure and can be deleted in two clicks by anybody. Annotate PDF is the right tool when you want to mark a passage; it deliberately leaves the text intact underneath, which is exactly the wrong property for a redaction.
  • Covering text with a patch. Edit PDF text works by laying a filled rectangle in the paper colour over the original run and drawing replacement text on top. That is ideal for a typo and unsafe for a name: the original glyphs are still in the file, underneath the patch, and a text extractor brings the old wording straight back. The tool page says so in as many words.
  • Flattening. Flatten PDF is often suggested as a poor man's redaction and it is not one. A flattened value can no longer be edited, but it is still there in full view — and even the rasterising mode simply photographs what was on the page, black box and all. Flattening removes interactivity, not information.

Checking your own work, in thirty seconds

  1. Do not trust the appearance of the file you are about to send. Open the downloaded copy — the actual output, not the editing view — and search for the word you removed. If the page has been rebuilt as an image, there is nothing to find, and a search that returns no hits is the confirmation you want. If the search finds it, you have drawn a rectangle, not redacted.
  2. Then select all the text on the page and paste it into a plain text editor. This catches the case where the word is stored differently from how it is spelled — split across two text runs, or written with a ligature — and would not match your search.
  3. Finally, keep your original. Redaction is one-way by design: the marked pages are rebuilt from a render, and no tool, ours or anyone else's, can bring the removed content back. If it later turns out you redacted a paragraph you needed, the only remedy is the file you kept. Running OCR PDF over the redacted copy afterwards will put a searchable text layer back over everything you chose to keep.

Questions

Can redacted text ever be recovered?

Not from a properly redacted file. Once the marked page has been re-rendered as an image with the boxes painted on, the removed text is not in the file in any form — there is nothing to recover. That is also why you should keep your original: the operation cannot be undone from the output.

Why is my redacted PDF suddenly much larger?

Because the pages you marked are now images 1600 pixels across, and a page of type costs far more as a picture than as drawing instructions. Only the marked pages are affected — the rest are copied through untouched — so a 200-page report with two redacted pages grows very little.

Does redacting remove the document's metadata too?

With Folia, yes, as a side effect of how it works: the output is assembled as a fresh document, so the original's bookmarks, title, author and other document-level properties do not come across. If you redact using a different tool, check the properties dialogue yourself — the author field is a common leak.

Can I redact a scanned document?

Yes, and it is the simplest case, because a scan is already an image with no text layer to leak. Mark the regions, and the boxes are painted onto the page render as usual. If the scan has been through OCR it does have a text layer, and that layer is removed along with everything else on the marked pages.

Is redaction the same as password-protecting a file?

No, and the distinction matters. A password controls who can open the document; it does nothing about what is inside it. Everyone you give the password to sees everything, including whatever a black rectangle appears to be covering. Redact first, then encrypt the finished file if it still needs it.

The tools this covers

Read next

PDF passwords explained: two passwords, one real lock, and a lot of advisory flags — Why some PDF passwords stop nothing, why a 1.4 file gets weaker encryption, and where in your workflow encryption actually belongs.

All guides