How to OCR Bates Numbered Documents Cleanly
By Schema LawPublished Updated
To OCR Bates numbered documents, run recognition on the stamped pages so that the number on each page becomes searchable text along with everything else, then confirm the stamps were read correctly. Keep one file per document, named by its first Bates number, so any page of text can be traced to its stamp.
A Bates number is, in the words of the Sedona Conference Glossary, part of a "sequential numbering system used to identify individual pages of documents where each page or file is assigned a unique number", often with a prefix naming the producing party. Everyone in the case cites pages by it. OCR that loses or garbles the number leaves you with text you can read and cannot cite.
Do Bates numbers survive OCR?
Bates numbers usually survive OCR, because a stamp is machine-printed text in a clear corner of the page, which is what recognition handles best. The risk is in the details: a digit read as a letter, a dropped leading zero, or a prefix split from its number by a stray space.
It helps to know which kind of stamp you have.
- A stamp that is part of the picture. Paper stamped by hand or by a numbering machine and then scanned, or a production flattened to images, carries the number as pixels. OCR has to read it like any other print.
- A stamp added by PDF software. Electronic stamping usually writes the number as real text on top of the page. That text is already searchable with no OCR at all, until someone prints the file or converts it to images, when it becomes pixels again.
Test which one you have by trying to select the number with your cursor. The post on why you can't copy text from a PDF explains what the result means.
When the stamp has to be recognized, these are the usual misreads:
| On the page | Often read as | Why it matters |
|---|---|---|
ABC0001530 | ABCO001530 | A zero next to letters becomes the letter O |
ABC0001530 | ABC 0001530 | A space breaks an exact search |
ABC_0001530 | ABC0001530 | The underscore is dropped or read as a hyphen |
DEF0011187 | DEF00lll87 | Ones become lowercase L |
SMITH000058 | SMITH0000S8 | Fives and letter S swap, as do 8 and B |
What survives also depends on the export. A searchable PDF keeps the page image, so the stamp is always visible even where its text was misread. Schema Law's searchable PDF export is your original file with a hidden text layer added to each page. Plain text and Word exports contain only what was recognized. If the stamp was misread there, the error is all you have, so check it against the image. No tool reads every stamp on every page, and the only test that counts is one run on your own production.
Should you OCR before or after Bates stamping?
For documents you are producing, stamp first and OCR the stamped pages. The text then contains the number, and it describes the exact pages the other side receives. For a working copy that will never be produced, the order does not matter. No rule fixes the sequence, so follow any protocol the parties agreed.
The reasoning changes a little with the situation:
| Situation | Order that works | Reason |
|---|---|---|
| A stamped production you received | OCR as received | The stamps are already on the pages |
| Paper you are producing | Scan, split into documents, stamp, then OCR | Text matches the produced images, stamp included |
| Files stamped electronically after OCR | Acceptable if the stamp is added as text | Check that the stamping step kept the text layer |
| Pages with redactions | Redact, stamp, then OCR the redacted pages | Text must not contain what the redaction hides |
The redaction row is the one that causes real harm when it goes wrong. Text recognized before redaction still holds the words you blacked out. If that text file travels with the production, you have disclosed them. The EDRM Production Standards reflect the fix: they call for "OCR for redacted files", meaning fresh text made from the redacted image.
Two habits prevent rework. Keep an unstamped master set, because a wrong prefix or starting number is far easier to fix by stamping again than by removing stamps. And avoid running OCR, stamping, and then printing the result to an image-based PDF. Flattening pages to images throws the text layer away, so you would have to run recognition a second time.
After recognition, search the text for the first and last Bates number in the production. You cite those numbers in discovery, and the digits have to stay readable on the image. If a digit drops out of the text layer, fix the text and leave the stamp alone. When you build the load file, the number in the text and the number on the page should match.
Keeping each page tied to its Bates number
A page stays tied to its Bates number when two things hold: each file is one document named by its first Bates number, and nobody adds, removes or reorders pages after stamping. Then the number for any page is the first number plus its position in the file, minus one.
A worked example: the file ABC0000120.pdf has nine pages. A passage you want sits on page 7 of the file. The cite is 120 + 7 - 1, so ABC0000126. Open page 7 and read the stamp to confirm before the cite goes into a brief.
That arithmetic only helps if page positions carry through to the text. In Schema Law's exports they do, in different ways:
- Plain text has a page break character between pages, so the seventh block of text is page 7.
- Word starts every source page on a new page.
- CSV, for a document without tables, lists each line of text with its page number in the first column.
- JSON numbers each page and gives the page count.
Keep a crosswalk sheet for the whole set. It is a spreadsheet with one row per file:
| File | First Bates | Pages | Last Bates |
|---|---|---|---|
| ABC0000120.pdf | ABC0000120 | 9 | ABC0000128 |
| ABC0000129.pdf | ABC0000129 | 2 | ABC0000130 |
| ABC0000131.pdf | ABC0000131 | 46 | ABC0000176 |
Three mistakes break the tie between page and number.
- Citing the viewer's page counter. Page 7 of 9 on screen is not a cite. Only the stamp is.
- Combining files. Merging a production into one large PDF is convenient until you need to know which document a page belonged to. Keep the per-document files and merge a copy if you must.
- Deleting blank or duplicate pages. Each stamped page holds a place in the sequence. Remove one and every later page in that file is off by one.
A review platform records the same link in a load file, where the name of each page image is, as the Sedona glossary puts it, "often the Bates number of the page". The guide to creating a load file from scanned PDFs builds one from this crosswalk.
Bates stamps that overlap the text
A Bates stamp printed across existing text damages both. The overlapping strokes merge, so OCR may misread the number, the words beneath it, or the two together. The usual victims are footers, page numbers, document IDs and signature blocks in the lower right corner, which is where stamps are normally placed.
If you are doing the stamping, prevent the collision:
- Look at a sample of pages for an empty area before choosing the corner. Financial statements and forms often fill the bottom margin and leave the top clear.
- Many stamping tools can shrink the page image slightly to make a clean margin for the number. Check whether yours can, and use it for full-bleed pages.
- Use a plain, dark, reasonably large font. Tiny grey stamps are the ones that get misread.
- Keep the same position on every page so a reader, and a checker, knows where to look.
If you received the pages already stamped, you cannot move anything. Treat the overlapped area as unreliable text. When the number matters, read it from the image. When the words beneath matter, such as a footer date or a form revision code, compare the text with the picture and ask the producing party for a clean copy if you cannot make it out. The post on whether OCR can read stamps over text goes into what a stamp does to the print under it.
Searching a set by Bates range
Searching by Bates range means going from a number, or a span of numbers, to the right files and pages. Text search finds one exact number. A range needs the crosswalk sheet, because "between ABC0001200 and ABC0001260" is arithmetic that a text search cannot do.
To find one page. Say a deposition exhibit cites ABC0001530. If your files are named by first Bates number, sort the folder by name and pick the last file whose name is at or below that number. With the crosswalk, it is the row where the first number is no higher than 1530 and the last number is no lower. Then the page within the file is 1530 minus the first number, plus one.
To find one number by text search. After OCR, your PDF reader's search can look for the stamp across a folder of searchable PDFs. Search the digits alone, 0001530, because the prefix is where spaces and letter swaps occur. No hit does not mean the page is missing. It may mean the stamp was misread, so fall back to the crosswalk.
To pull a range. Opposing counsel's letter refers to ABC0001200 through ABC0001260. Add two helper columns to the crosswalk holding the numeric part of the first and last Bates numbers. Filter for rows where the last number is at least 1200 and the first number is at most 1260. The rows left are every file that touches the range, including documents that start before it or run past it.
Store the numeric part as a number and the full Bates label as text. A spreadsheet that treats 0001530 as a number will display 1530 and quietly drop the zeros from anything you copy back out.
Checking for gaps and duplicates in the numbering
Check the numbering by sorting the crosswalk and testing one rule: each file's first number is one more than the previous file's last number. A jump is a gap. A step backwards is an overlap, which means duplicate numbers. Run the check when a production arrives and before one leaves.
In a spreadsheet, put the files in order and add a column that subtracts the previous row's last number from this row's first number. Every result should be 1. Anything larger is a gap of that many pages, less one. Zero or a negative number is a duplicate.
Then check against what you were told. A production normally comes with a cover letter stating its range. The SEC's Data Delivery Standards, for example, require a cover letter listing custodians and "the Bates range for each custodian". Your first and last numbers should match the letter, and your page total should equal the size of the range.
Not every gap is an error. Sort what you find into three groups:
- Explained gaps. Documents withheld for privilege or produced in another form often leave numbers unused, sometimes with a placeholder page. A privilege log or the cover letter should account for them.
- Stamping errors. The numbering restarted, skipped, or ran twice over the same pages. Suffixes such as
ABC0000123.001can mean pages were inserted after the original run. - Reading errors. The stamp is fine and the OCR text is wrong. To find these, compare the number expected on each page with the number recognized there. In a CSV export of a document without tables, filter the text column for your prefix and you get one row per page showing what was read, beside the page number. Any row that disagrees with the arithmetic is worth a look at the image. The method for proofreading OCR output against the original applies here in miniature.
Fix reading errors in your own working copy and leave the produced files alone. Raise unexplained gaps and duplicates in a received set with the producing party, in writing and by number. The post on making a document production searchable covers how to preserve the set as received while you work on a copy. Schema Law's CSV and JSON exports are included on every plan, the free one too, and the pricing page lists the page limits for each plan.