Tools,

Docling with Tesseract: tesserocr or the CLI

ocr_options=TesseractCliOcrOptions(lang=["eng"])

Same Tesseract version and model. The CLI engine found 95.9% of our scan's words, tesserocr 94.2%.

Fix a start error

CLI engine and our Actor led

Words found on our 10-page scan, of 1,955
Reader Words found
Docling + tesseract CLI 1,875 (95.9%)
Docling + tesserocr 1,841 (94.2%)
Docling default (RapidOCR) 1,855 (94.9%)
Tesseract alone (OCRmyPDF) 1,853 (94.8%)
Our Actor 1,877 (96.0%)

10 scanned book pages from Wikisource. A word counts as found when it is right and in the right order.

Why tesserocr found fewer words

TesseractOcrOptions in Python

pip install docling tesserocr
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions, TesseractOcrOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

options = PdfPipelineOptions(ocr_options=TesseractOcrOptions(lang=["eng"]))
converter = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=options)}
)
print(converter.convert("scan.pdf").document.export_to_markdown())

Save it as docling_tesseract.py next to scan.pdf. Run it with the folder that holds eng.traineddata:

TESSDATA_PREFIX=/opt/homebrew/share/tessdata python3 docling_tesseract.py > scan.md

That is Homebrew's folder on an Apple Silicon Mac. Elsewhere, use the folder that tesseract --list-langs prints.

For the CLI engine, write TesseractCliOcrOptions in the import and in the options line. It needs no TESSDATA_PREFIX.

From the command line

docling convert scan.pdf --ocr-engine tesseract --ocr-lang eng

It writes scan.md in the current folder. For tesserocr, use --ocr-engine tesserocr and set TESSDATA_PREFIX first.

4 start errors, and their fixes

Our Actor reads scans with no setup

PDF OCR to Markdown, our Apify Actor, found the most words on the same scan.

No Python and no tessdata folder: send the PDF, get Markdown back.

What I did not test

How I tested it
  • 10 proofread book pages from 2 Wikisource books, as a 300 ppi image-only PDF: the scan of count words in a PDF. 1,955 words. The OCRmyPDF and Actor rows come from that test.
  • Words found: proofread words found in order in Docling's export_to_text. Its Markdown gave the same counts.
  • Each engine ran in a fresh Python process with Docling's defaults, at nice 19 and background priority, 4 threads. The two Tesseract engines got lang=["eng"]. The default ran untouched.
  • No speed ranking: the Mac was busy, and two warm runs of tesserocr took 2.4 and 4.4 s a page.
  • The Actor row is its code (build 0.1.125) run on our Mac, with text output.
  • Docling 2.151.1, docling-core 2.108.0, tesserocr 2.13.0 (its own Tesseract 5.5.4), Homebrew Tesseract 5.5.4, eng.traineddata from tessdata_fast 4.1.0, torch 2.15.0, RapidOCR 3.10.0, Python 3.12.12 (arm64), macOS 26.6.
  • The first run of each engine waited minutes (404 s for the first import) while macOS checked each new library once. The reruns in the table did not wait.
  • Scripts and results stay in our private repo, in research/bench/docling-tesseract-2026-11-22/.
Sources

Questions people ask

How do I use Tesseract with Docling?

Set ocr_options=TesseractCliOcrOptions(lang=["eng"]) in PdfPipelineOptions, or TesseractOcrOptions for tesserocr. From the command line: docling convert scan.pdf --ocr-engine tesseract --ocr-lang eng.

tesserocr or the tesseract CLI: which is better in Docling?

On our scan the CLI engine found 1,875 of 1,955 words and tesserocr 1,841, with the same Tesseract version and model. The CLI engine also needs no TESSDATA_PREFIX.

How do I fix "tesserocr is not correctly configured"?

tesserocr found no language models: our wheel had none. Set TESSDATA_PREFIX to a folder with eng.traineddata, like the one tesseract --list-langs prints (/opt/homebrew/share/tessdata on our Mac), or pass that folder as path= to TesseractOcrOptions.

Does Docling use Tesseract by default?

No. It takes the first installed engine that fits. On a Mac: ocrmac, RapidOCR with onnxruntime, EasyOCR, then RapidOCR with torch. A plain pip install docling on our Mac used RapidOCR with torch.

Two ways to skip the work

Run it yourself. Our Apify Actor turns scanned PDFs into Markdown, tables included.

Try the Actor

Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.

Get one page free