Promythicus FR root@promythicus.com

Promythicus / Blog

Using a local AI on scanned documents: character recognition without the cloud

By Bardia Shahrestani, Promythicus Inc. · Published

A scanned page is a picture, and a language model cannot read it until the picture is turned into text. Open-source character recognition does this on the same machine as the model, so scans never have to go to a cloud service. Clean typed scans come out nearly perfect. Tables, stamps and handwriting are where mistakes happen, and those need a check.

Typed PDF or scan?

Open the PDF and try to select a sentence with the mouse. If the text highlights, the file already contains its text and needs nothing. If the whole page selects as one image, it is a scan.

Adding the text layer

OCRmyPDF, built on the Tesseract engine, reads a scanned PDF and writes a copy with the recognized text hidden behind each page image. The page looks the same and becomes searchable:

sudo apt install ocrmypdf tesseract-ocr-fra tesseract-ocr-eng
ocrmypdf -l fra+eng --deskew --rotate-pages scan.pdf readable.pdf

-l fra+eng tells it the document may be in French and English. --deskew straightens crooked pages. Everything runs on the server.

What goes wrong

ProblemWhat happensWhat helps
Low-resolution or faxed pagesWrong letters, especially in numbersRescan at 300 dots per inch if the paper exists
TablesColumns run together into one lineA vision model for those pages, or check by hand
Stamps and signatures over textThe words underneath are lostFlag the page for a person
HandwritingMostly unreadable to classic recognitionA vision model, with every result checked
Accents in FrenchDropped if the French language data is not installedInstall it and name both languages

Why numbers need the most care

A language model reading recognized text will repair a misspelled word without noticing. It cannot repair a wrong digit, because 1,800 and 7,800 are both plausible rents. For amounts and dates taken from scans, the assistant should show the image of the page, not just the recognized text, so the reader compares the two.

Vision models

Some open-weight models read page images directly. They handle tables and messy layouts better than classic recognition and are much slower per page. A practical setup uses classic recognition for everything and sends only the difficult pages to a vision model.

Do it once, at intake

Run recognition when a document enters the system and keep the readable copy. A large archive takes hours the first time and nothing afterwards.

Questions and answers

Can a private AI read scanned documents?
Yes, after character recognition turns the scans into text. Open-source tools such as Tesseract and OCRmyPDF do this on the same machine, so nothing is sent to a cloud service.
How accurate is open-source character recognition?
Very accurate on clean typed scans at 300 dots per inch. Tables, stamps, low-resolution faxes and handwriting cause mistakes and need a check.
Does OCR work in French?
Yes, when the French language data is installed and the tool is told the document is in French.

Sources