Using a local AI on scanned documents: character recognition without the cloud
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
| Problem | What happens | What helps |
|---|---|---|
| Low-resolution or faxed pages | Wrong letters, especially in numbers | Rescan at 300 dots per inch if the paper exists |
| Tables | Columns run together into one line | A vision model for those pages, or check by hand |
| Stamps and signatures over text | The words underneath are lost | Flag the page for a person |
| Handwriting | Mostly unreadable to classic recognition | A vision model, with every result checked |
| Accents in French | Dropped if the French language data is not installed | Install 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.