Docling OCRIndependent Docling guide

Core concept · Docling OCR

Docling OCR: What the OCR Step Actually Does

Docling is not an OCR engine. It is a document pipeline that uses OCR as one stage — and on many PDFs it never calls it at all. Understanding that distinction explains most of the confusing behaviour people hit on day one.

Updated 2026-10-26 · 5 min read

The short version

  • –OCR in Docling is conditional: pages that already carry a text layer are read directly, because recognizing pixels is strictly worse than reading the characters that are already there.
  • –Layout analysis and table structure come from separate models (DocLayNet-style layout, TableFormer) and run whether or not OCR runs.
  • –The OCR engine is pluggable — RapidOCR, EasyOCR, Tesseract, ocrmac, Nemotron, or a remote KServe endpoint — and the default is auto.
  • –Most "Docling OCR does not work" reports are one of three things: OCR disabled, a scanned page with no text layer and no engine installed, or the wrong language pack.

The pipeline, in order

A PDF is not a document. It is a set of instructions for placing glyphs and images on a page. There are no paragraphs, no tables, no reading order — only coordinates. Every document AI tool is therefore in the business of reconstructing structure, and Docling is explicit about the stages it uses to do it.

For each page, Docling roughly does this:

1

Decide whether the page needs pixels

If the page has a usable embedded text layer, the text is taken from the PDF itself. If the page is a scan — one big image, no text objects — the page has to be rasterized and OCRed. This decision happens before any model runs.

2

Analyze layout

A layout model segments the page into typed regions: text, title, table, figure, caption, list, formula, header/footer. This is a vision model working on the rendered page, so it sees the page the way a human does.

3

Recover reading order

Multi-column papers, sidebars and footnote blocks have no inherent order in the file. Order is inferred from geometry, which is why double-column arXiv papers are a classic failure case for naive extractors.

4

Reconstruct tables

TableFormer predicts cell boundaries and row/column spans for detected table regions. This is the part that separates Docling from text-only extraction, and the reason tables come out as structured cells rather than a wall of text.

5

Recognize text where it is only pixels

OCR runs on the regions that need it — scanned pages, image-only regions, or the whole page when you force it.

6

Assemble a DoclingDocument

Everything is assembled into a typed document object you can export to Markdown, JSON, DocTags, HTML, or chunked for retrieval.

The practical consequence: OCR quality is not the same as Docling quality. A born-digital PDF with a good text layer gets near-perfect text with zero OCR involved, while a 150 DPI fax of the same page depends almost entirely on the OCR engine and the scan.

When OCR runs — and when it does not

Docling enables OCR by default (do_ocr=True in PdfPipelineOptions, no --no-ocr on the command line), but "enabled" does not mean "applied to every page". Pages with an extractable text layer are parsed from that layer.

This is a feature, not a shortcut. An OCR pass over clean digital text introduces recognition errors that were not there before. Running Tesseract on a digitally generated bank statement is how you turn a perfect 1,450.00 into l,450.00.

  • Digital PDF, text layer present — text read directly; OCR skipped; layout and tables still modeled.
  • Scanned PDF or image-only page — page is rasterized and OCRed; layout and tables modeled on the rendered page.
  • Mixed document — handled page by page; a faxed signature page in the middle of a digital contract is not a problem.
  • OCR disabled (do_ocr=False / --no-ocr) — scanned pages come out empty or as figures. This is the most common "Docling returned nothing" cause.
  • Forced full-page OCR — overrides the text layer entirely; useful when the embedded text is garbage (bad OCR already baked into the PDF, or broken font encoding).
Forcing OCR on every page (Python)
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter, PdfFormatOption

opts = PdfPipelineOptions(
    do_ocr=True,
    force_full_page_ocr=True,   # ignore the embedded text layer
)
converter = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=opts)}
)
doc = converter.convert("statement.pdf").document
print(doc.export_to_markdown())

Which OCR engine is actually running

The engine is chosen with --ocr-engine (CLI) or ocr_options (Python), and the default is auto. The engines Docling can drive are RapidOCR, EasyOCR, Tesseract (via the CLI or the tesserocr binding), ocrmac on macOS, Nemotron-OCR, and a remote KServe v2 endpoint.

Each one has different install weight, language coverage and failure modes — RapidOCR ships ONNX models and runs on CPU, EasyOCR pulls PyTorch, Tesseract needs system packages and tessdata, and ocrmac is macOS-only. The engine comparison covers when to pick which.

Docling does not publish a single accuracy ranking across engines, and neither should anyone selling you one: accuracy depends on script, scan quality, table density and language. What you can control is the engine, the language list, and the DPI of what you feed it.

Reading the output: what good looks like

A clean Docling run gives you more than text. The DoclingDocument retains structure: which text is a heading, which block is a table, which row is a header, and where each of those came from on the page. That structure is the point — it is what makes the difference between a Markdown blob and something a spreadsheet, a search index or an auditor can use.

Three checks catch most silent failures:

  • Row count sanity. A 40-row statement should not produce 12 rows. Missing rows usually mean the table was not detected, not that the OCR misread it.
  • Number integrity. Spot-check negatives, thousands separators and currency symbols. (2,300) becoming 2,300 flips an expense into income downstream.
  • Header alignment. If column headers drifted one cell right, every figure is under the wrong column, and nothing in the file will tell you.

Any conversion you cannot check against the source page is a guess with a nice font. Keep the page reference with each row whenever the output will be used for money.

When you do not want to run OCR yourself

Docling is MIT-licensed and free, but "free" stops being the relevant number once you are maintaining CUDA drivers, model caches and per-language tessdata on a laptop that has to do something else. The install is the hard part, not the parsing.

If the goal is a converted document rather than a pipeline, the same Docling-family models run behind the online Docling OCR web UI — drop the PDF, get Markdown or Excel, no Python. The Docling to Excel guide covers the spreadsheet path in detail.

Frequently asked questions

Does Docling OCR every page by default?+

OCR is enabled by default, but it is only applied where a page has no usable text layer. Digital PDFs are read from their embedded text. Use force_full_page_ocr / --force-ocr when the embedded text is broken.

Do I need to install Tesseract to use Docling?+

No. RapidOCR is available as a pip extra and runs on CPU, and EasyOCR is another option. Tesseract is only needed if you choose it as the engine (and on macOS, ocrmac uses the system Vision framework instead).

Why did Docling return empty text for my scanned PDF?+

Almost always one of: OCR was disabled (--no-ocr), no OCR engine was installed, or the scan is too low-resolution for recognition. Check the page count and text length in the output before assuming the file is unsupported.

Is Docling OCR better than Tesseract?+

They do different jobs. Tesseract recognizes glyphs; Docling models layout, reading order and table structure around whatever recognizer you pick. Docling can use Tesseract as its recognizer. For plain single-column text, a plain OCR engine is enough; for tables and multi-column documents, structure modeling is what matters.

Can Docling OCR handwritten documents?+

Partly. Recognition quality depends on the engine and the handwriting. Printed forms with handwritten entries are workable with review; free-form cursive is not reliable in any pipeline, including this one.

What output formats can Docling produce?+

Markdown, JSON (DoclingDocument), YAML, HTML (single or split page), plain text, DocTags, VTT, DocLang, DCLX, LaTeX and chunks. Excel is not a native exporter — see the Docling to Excel guide for the path.

Try it online

Run the same pipeline in the browser — no install, no uploads stored.

Try it in the browser

Keep reading