Schema LawSign in with Google

OCR Before or After Redaction? The Order That Is Safe

By Schema LawPublished Updated

Run OCR before redaction on a working copy, so you can search for what needs redacting. Then make the text that leaves your office after redaction, by recognizing the redacted pages or by using a tool that removes the words along with the image. The sequence that fails is OCR first, boxes drawn on top second.

The rest of this post explains why that sequence fails, where else the hidden words can survive, and how to test a production before it goes out. It covers handling your own redactions. It is not legal advice on what must be redacted.

Should you OCR before or after redaction?

Do both, on different copies. OCR the unredacted working copy first, because searchable text is the fastest way to find every name, number and privileged passage. Then create the outgoing copy so that its text comes from pages on which the redacted words are already gone.

There are two sound ways to build the outgoing copy, and one unsound way.

SequenceWhat ends up in the outgoing fileSafe?
OCR the scan, then draw black boxes over the wordsPage image with boxes, plus a text layer that still holds every wordNo
OCR the scan, then apply a true redaction tool that deletes the marked text and image, then verifyPage image with the words removed, text layer with the same words removedYes, if the tool does what it says and you test the result
Redact the page image so the pixels are gone, then run OCR on the redacted imagePage image with the words removed, text layer built only from what is still visibleYes

The third row is the simplest to reason about. Recognition can only read what is on the page it is given. If the pixels under the bar are solid black before OCR runs, no text for those words is ever created.

The second row is how dedicated redaction tools work. Adobe's own tutorial on removing sensitive information in Acrobat describes the Redact tool as a way "to permanently remove private or sensitive information from a PDF", with a further step to "sanitize and remove hidden information", after which the result is "saved to a new file." That describes Adobe's product in Adobe's words. Whatever tool you use, the test later in this post applies.

Which copy gets which treatment

Keep three files and never confuse them:

  1. The original as received or scanned. Untouched, stored where it cannot be sent by accident.
  2. The working copy with full OCR text. For your review only. This is the file you search.
  3. The outgoing copy. Redacted, then given its text, then tested.

Name them so the difference is visible in a file list: _ORIGINAL, _WORKING, _REDACTED. The District of New Jersey's guidance on redaction techniques for e-filing makes the same point about saving "the redacted version with a new name."

Why your redaction box hides the image and not the OCR text

A redaction box drawn with a shape or highlighter tool is a picture placed over the page. The OCR text sits in a separate invisible layer underneath. Covering the picture does nothing to the layer, so the words can still be found by search and remain part of the file you send.

The full explanation, with the courts' warnings about drawn boxes, is in the post on hidden text in a PDF, under why a black box drawn over words leaves the words in the file. The post on making a scanned PDF searchable explains what makes a scanned PDF searchable, which is the text layer at issue here.

What matters for the order of work is when the layer arrives. Before OCR, a scan has no text at all, so a box merged into the image hides everything there is to hide. After OCR, the same box leaves a second copy of every word untouched. A habit that was sound on plain scans starts leaking the day the office begins running OCR on everything.

Redaction has to reach that second copy, or the words remain electronically stored information in the file you send. Sensitive personal information, such as a full account number, can survive in the hidden layer after the image looks clean. Search the outgoing file for the personal data you meant to remove, then open it in a second reader and search again.

Redacting on paper before scanning has a weakness of its own. The D.C. Circuit's guidance on redacting personal data identifiers warns that ink marking or semi-translucent tape over a page that is then scanned "can still sometimes show enough information for someone to see what was assumed hidden." A marker pass that looks black on paper can scan as dark gray with the letters faintly visible, and OCR may read them. If you redact on paper, check the scan at high zoom and then check what recognition made of it.

Redacting a scan already exported to Word or Excel

Once a scan has been exported to Word, Excel, CSV or plain text, each export is a separate full copy of the words. Redacting the PDF does nothing to them. Either redact every export that will leave the office, or delete the exports and make new ones from the redacted PDF.

The second course is the safer one. A fresh export from redacted pages cannot contain a word the redaction removed, while a hand-edited Word file can still hold one you missed.

If you must redact inside an export, know where the content hides in each format:

  • Word. Deleting the visible words is not enough if Track Changes is on, because the deletion is recorded and can be shown again. Comments, headers, footers, footnotes and document properties are separate places to look. The D.C. Circuit guidance warns that word processing files "retain a lot of hidden code" that "can contain revision history and other information", and it recommends building the redacted version in a new, clean file.
  • Excel. A value can sit in a hidden column, a hidden sheet, a cell comment or a formula that references a cell you cleared. Check every sheet in the workbook.
  • CSV and plain text. These hold nothing but the characters you see, which makes them the easiest formats to check. Search them and read the lines around each hit.
  • JSON, Markdown and HTML. These are text files as well. A JSON export may repeat the same page text in more than one field, so search the whole file and do not stop at the first hit.

Replace, do not just delete. The D.C. Circuit guidance suggests substituting a marker such as "[REDACTED]" so a reader can see that something was removed. It also flags a trap with find and replace: a search for "John Q. Public" will not catch "J. Public" or "John Public". OCR adds one more variant, the misread. A name recognized as "Jchn Public" will slip past every search for the correct spelling.

Remember the copies you did not think of as exports. Text pasted into an email, a chronology, a deposition outline or a case management note came from the working copy and is unredacted. Those are internal documents and usually should stay that way. The risk arises when one of them is later attached to something that goes out.

Running OCR on a document someone else redacted

Running OCR on a document that arrived with redactions gives you text for the visible words only, and that is all you should expect. Proper redaction leaves nothing under the bar to recognize. Convert the file as you would any scan, keep the received version untouched, and watch for sentences that the conversion has silently joined across a gap.

What OCR does around a redaction bar:

  • It may skip the bar and run the words on each side together into a sentence the page never contained.
  • It may read the bar as a stray character, a row of blocks or a table border.
  • It may read a label printed on the bar, such as an exemption code or the word "Redacted", as ordinary text.

The post on criminal discovery covers how to mark these gaps in a working copy, under redactions and blacked-out passages.

When the received file was redacted badly

Occasionally a file from another party has bars on the page and the words still present in its text. You may notice because a search hits a term inside a blacked-out area. Stop there. Do not go looking for more, and do not run the file through further tools to see what comes out. Take it to the responsible lawyer.

What happens next is a question of professional responsibility and procedure, and the answer varies by jurisdiction. In federal civil discovery, Rule 26(b)(5)(B) of the Federal Rules of Civil Procedure describes what follows once a producing party gives notice of a privilege claim: the receiving party "must promptly return, sequester, or destroy the specified information and any copies it has" and "must not use or disclose the information until the claim is resolved". Your own jurisdiction's conduct rules may add to that, so ask the supervising lawyer. Sequester the file until the lawyer decides.

One handling point matters regardless of the law. If you had already uploaded the file to an OCR service before noticing, the upload and its exports are copies. List them, so that whatever the lawyer decides can be carried out everywhere.

How do you test your redacted production for leftover text?

Test the final outgoing files, in the exact form they will be sent, by searching them for what you removed. A redaction is only finished when a search of the outgoing copy for each redacted term returns nothing and the text extracted from each redacted page shows a gap where the bar is.

Run these checks on the outgoing copy, never on the working copy:

  1. Search for every redacted term. Keep a list as you redact: names, account numbers, the distinctive phrases in a privileged paragraph. Search the final PDF for each one. Zero hits is the pass mark.
  2. Search for fragments. Try the last four digits of a number, a surname alone, a partial address. A text layer can break a string in unexpected places.
  3. Extract the text and read the redacted pages. Save or export the final PDF as plain text and open the pages that carry redactions. You should see the surrounding words and nothing where the bar sits.
  4. Check every companion file. A production may travel with page-level text files, a load file, or native spreadsheets. If the text files were generated before redaction, they hold the unredacted words. Regenerate them from the redacted pages and search them too.
  5. Check the document properties. Title, subject, author and keyword fields can carry a client name or a file path. So can the file name itself.
  6. Look at the page. Zoom in on each bar. A bar that is slightly too short leaves the first or last letters readable, and a bar on one page does nothing for the same line repeated on the next.

A second person should run the checks when the stakes are high. The person who drew the redactions knows where they are and tends to look there, while a fresh reader searches the whole file.

A worked example

A fictional production: your client, Marlow Dental Group, is producing 310 scanned pages of billing correspondence to Castellan Supply. Twelve pages quote advice from outside counsel, and 40 pages show patients' account numbers.

You OCR the working copy and search it for the law firm's name, the lawyers' surnames, "privileged", "advice" and "counsel". That finds eleven of the twelve pages. The twelfth turns up on a manual read, because the scan had rendered the firm's name as "Hartwel1 & Dunn" with a digit in place of a letter. You redact the outgoing copy with a redaction tool, export its text, and search for both spellings and for each account number's last four digits. One hit remains: an account number repeated in a fax header on page 207. You redact it, export again, and get zero hits. The log records each step.

A redaction order of operations for a paralegal

The order is: preserve, recognize, find, review, redact, rebuild the text, test, log. Each step works on a specific copy, and the outgoing copy is created late so that it never contains anything you did not decide to include.

  1. Preserve the original. Store the file as received and do not open it for editing again.
  2. Make a working copy and run OCR on it. Schema Law's export formats include a searchable PDF, described as "Your original file with a hidden text layer, so search finds the page". An export like that carries every recognized word, so it belongs with the working copy and never with the outgoing set.
  3. Search the working copy. Use your list of terms. For identifiers such as Social Security and account numbers, the post on OCR for documents with Social Security numbers lists what court rules require you to look for.
  4. Read what search cannot find. Handwriting, stamps, poor scans and misread names need eyes. Search narrows the work and does not finish it.
  5. Have the lawyer decide. Give the lawyer a list of proposed redactions with page numbers and reasons. What to withhold is a legal decision.
  6. Redact a fresh copy of the original. Use a tool that removes content, or redact the image so the pixels are replaced.
  7. Build the outgoing text from the redacted pages. Run OCR on the redacted file, or confirm that your redaction tool removed the matching text.
  8. Regenerate companion files. Text files, spreadsheets and any load file come from the redacted version only.
  9. Test. Run the six checks in the section on testing a redacted production.
  10. Log and send. Record who redacted, who tested, the search terms used and the date. Send from the folder that holds only outgoing copies.

A redaction log can be as plain as this:

PageLocationReasonRedacted byTested byTest result
MDG000207Fax header, top linePatient account numberR. OkoyeT. Lindqvist0 hits for last four digits
MDG000118Second paragraphAttorney-client communicationR. OkoyeT. Lindqvist0 hits for firm name, both spellings

Clean up afterward. The working copy with full text is the most sensitive file in the set, because it is complete and searchable. Keep it in the restricted matter folder, delete the copy in your downloads folder, and delete the upload from the OCR service once the exports are checked. Schema Law lists "Delete any document, at any time" for every plan.

All posts in Confidentiality