My PDF workflow post ended with OCR as one of the things I need from a PDF tool. Master PDF Editor can OCR a document, but it does one document at a time. That’s fine for a single contract. It’s miserable for a folder of scanned exhibits.

Scanned exhibits come in piles. A recent matter had a folder of image-only PDFs: check images, tax returns, a letter that somebody faxed in. I don’t want to open each one, click OCR, and wait. I want to point a tool at a folder and come back later.

So I split the job between two Debian packages. Both come from the standard repositories.

sudo apt install ocrmypdf gimagereader

Two tools, two jobs

ocrmypdf is a command-line tool. It adds an invisible text layer to an existing PDF. The page looks the same as the scan, but you can search it, select it, and copy from it. That’s the right tool when the scan has to stay visually faithful, which is most of what I file. Out of the box it writes PDF/A, an archival flavor of PDF. I don’t want it: it can change the file in ways I didn’t ask for, and courts and clients want a plain PDF. So I turn it off with --output-type pdf, which you’ll see in the loop below.

gImageReader is a desktop app. Both tools use the same engine underneath, Tesseract, the open-source program that does the character recognition. The difference is the wrapper: ocrmypdf is a command you script, and gImageReader is a window you click around in. You import a batch of scans, run OCR on all of them, and then review the recognized text in a side-by-side pane. That review step matters when a scan is rough: faint print, a fax that’s been through three machines, handwriting. ocrmypdf won’t show you what it misread. gImageReader will.

Most intake tasks, I’d reach for ocrmypdf first. gImageReader is for the pages where I want to check the text before I trust it.

Batch with ocrmypdf

The core of it is a loop. Run it in the folder with the scans:

mkdir -p ocr
for f in *.pdf; do
  ocrmypdf --output-type pdf "$f" "ocr/$f"
done

The original files stay where they are. The searchable copies land in ocr/ with the same names. Quoting "$f" matters, because scanned filenames tend to have spaces in them.

Two things I’d check before trusting a batch run:

  • Files that already have text. ocrmypdf stops on a page that already has a text layer, which is usually what you want. If a batch has a mix of scans and born-digital PDFs, you can tell it to skip pages that already have text with --skip-text. I haven’t tested that flag yet, so check the output on a few files first.
  • The log, not just the exit. Read what scrolls past instead of trusting a quiet finish. A loop that ends without a visible error isn’t proof that every file was processed, so spot-check the ocr/ folder against the originals.

The review pass with gImageReader

gImageReader’s export options are where I got tripped up. It can export a searchable PDF that keeps the page’s appearance, but that only works in hOCR mode. The plain PDF export is a different path with different tradeoffs for fidelity. If the output has to look identical to the scan, confirm which mode you’re using before you export a batch.

For a rough scan, the review pane is the reason to open gImageReader at all. For a clean scan, ocrmypdf alone is enough.