New Tool Radar

AI PDF

How to Check That Your OCR Language Pack Is Installed

When OCR returns garbage on a foreign-language page, check the installed language data first — the engine cannot read a language it was never given.

Schematic illustration of a German letter OCR run returning garbage with English-only data, then reading correctly once the German language pack is installed.

OCR that returns nonsense on a perfectly legible page usually has the wrong language data, not a broken engine. Tesseract’s installation documentation is blunt about the split: there are two parts to install, the engine itself and the trained data for the languages, and language packages are named by three-letter code, such as tesseract-ocr-deu for German. English is the usual default; anything else must be added.

The same documentation says the error to watch for is an “Error opening data file” message naming the missing trained-data file. The check is one command — tesseract –list-langs — and the fix is installing the matching package before running OCR again. The OCRmyPDF manual adds that its -l option takes the languages from the installed Tesseract packs, and the Nutrient OCRmyPDF guide notes that a language being unavailable means installing its Tesseract language pack and re-checking with –list-langs.

Use the practice file

A fictional one-page German business letter, practice-german.pdf, whose first line reads “Sehr geehrte Damen und Herren,” and which mentions an invoice total of 240.00 and a due date of 12 December.

Run Language data First line of output
1 English only Garbage — umlauts and long words misread
2 German installed, -l deu Sehr geehrte Damen und Herren,

The trap is the second run: installing the German pack is not enough on its own — the run must also ask for German with -l deu, or the engine still defaults to English.

List the languages, install the missing one, rerun

Expected result. We checked the Tesseract installation documentation, the OCRmyPDF manual, and the Nutrient OCRmyPDF guide. We did not run any OCR or scan tool. The checks below are what to expect if the review is done correctly; run them yourself on the practice file.

1. List the languages already installed

Run tesseract –list-langs in a terminal. The list shows every language the engine can actually use right now.

Expected result: the list shows eng and osd only — no deu, so German is not installed.

2. Match the missing language to its three-letter code

Find the page’s language and its three-letter code: deu for German, fra for French, spa for Spanish, chi-sim for Simplified Chinese. Tesseract’s documentation lists packages by these codes.

Expected result: the letter is German, so the missing code is deu.

3. Install the language pack

Install the matching package — on Debian or Ubuntu, sudo apt install tesseract-ocr-deu; on Windows, select the language in the UB Mannheim installer or copy the trained-data file into the tessdata folder. Get the file from your package manager or the official tesseract-ocr repositories, not a random download.

Expected result: the German pack is installed from the package manager.

4. Confirm the language appears in the list

Run tesseract –list-langs again. Do not rerun OCR until deu shows up — an “Error opening data file” for deu.traineddata means the install did not land.

Expected result: the list now shows deu alongside eng and osd.

5. Rerun OCR asking for German

Run OCR with the language requested, such as tesseract letter.png out -l deu, or ocrmypdf -l deu for a PDF. Then read the first line and the figures against the original.

Expected result: the first line reads “Sehr geehrte Damen und Herren,”; the total 240.00 and the date 12 December match the original.

Verdict table

Check Expected result Pass?
Languages listed eng and osd only; no deu —
Missing code found deu for German —
Pack installed From the package manager —
List re-checked deu now present —
Rerun with -l deu First line and figures match the original —

Related guides: Pick an OCR language for a multilingual scanned PDF — when one page mixes two languages. Check if a PDF needs OCR — confirm the pages need OCR at all.

Limits

  • Installing a language pack does not fix a bad scan: faint, skewed or low-resolution pages still need the image fixes in the other guides in this series first.
  • UNTESTED — no OCR tool was run and no language pack was installed; all results above are expected results. The practice file is fictional.

Sources

See all