Getting your file…

A Black Box Doesn't Redact a PDF

A Black Box Doesn't Redact a PDF

The Two-Second Test

Open a PDF that someone has "redacted". Put the cursor just before one of the black boxes, drag across it, copy, and paste into a plain text editor.

If words appear, the document was never redacted. Someone painted over it.

That test has embarrassed government agencies, law firms and courts for twenty years, and it still works on documents published this year. The reason is not carelessness alone. It is how a PDF page is built, and once you see that, the failure stops looking mysterious.

A PDF Page Is a List of Drawing Instructions

A PDF page is not a picture. It is a sequence of instructions: set this font, move here, write these characters, draw this line, fill this rectangle. A viewer runs them in order, and whatever is drawn later lands on top of whatever was drawn earlier.

When you draw a black rectangle over a line of text in an ordinary PDF editor, you add one more instruction at the end: fill a rectangle here, in black. The instruction that writes the text is still there, unchanged. On screen the rectangle hides it. To anything that reads the file instead of looking at it — copy and paste, search, a screen reader, a search engine, a one-line script — the text is exactly where it was.

We built a small test file to show it: three lines of text, with a black box drawn over an account number. This is what pdftotext, a standard command-line tool, prints for it:

Patient: Jane Example
Account number: 4111 2222 3333 4444
Diagnosis: confidential

The box is solid black in every viewer. The number is still in the file. Then we ran the same file through a real redaction and asked again:

Patient: Jane Example
Account number:
Diagnosis: confidential

Same box on the page. This time the characters underneath are gone from the file, and there is nothing left to copy.

It Keeps Happening

Three cases, years apart, with the same cause:

None of these teams lacked resources. They used a tool that draws boxes when the job needed a tool that removes content, and the two look identical on screen.

Other Places Text Hides in a PDF

The text under the box is the famous failure. It is not the only one.

What Real Redaction Does

Real redaction changes the file, not just its appearance. For every marked area it:

  1. finds the text whose characters fall inside the area and deletes those characters from the page's instructions;
  2. erases the pixels of any image that lies under the area, so a scanned page is changed too;
  3. only then paints the black box, as a marker of where something was removed;
  4. writes the result as a new file, so the earlier versions do not travel along.

That is what our Redact PDF tool does, using the MuPDF engine. You can drag across areas on a page preview, or type a name or number and have every occurrence on every page blacked out at once. A checkbox, on by default, also removes the document properties.

It has limits, and they are worth knowing before you rely on it:

Check Before You Send

Whatever tool you use, check the result yourself before it leaves your hands:

  1. Drag across each black box, copy and paste into a plain text editor. Nothing should appear.
  2. Search the document for the names and numbers you removed. There should be no matches.
  3. Open the document properties and read every field.
  4. Open the bookmarks and attachments panels.
  5. Keep the original somewhere safe. Redaction cannot be undone, which is the whole point.

Two seconds of copy and paste is cheaper than a hearing.

Category: File Formats