Docling vs TrOCR
Pick Docling to turn whole documents (PDF, DOCX, PPTX, XLSX, HTML, images) into structured Markdown or JSON, for example RAG ingestion of born-digital files. Pick TrOCR to read single cropped text-line images, mainly English handwriting or receipt lines. They are not substitutes: TrOCR reads one line and has no layout, so you need a line detector in front of it, while Docling works at page level but leaves scan accuracy to the OCR engine you plug in.
Doclingibm/docling | TrOCRmicrosoft/trocr | |
|---|---|---|
| Type | Open source | Open source |
| Price | 2 credits / page | 1 credit / page |
| Per 1,000 pages | $2.00 | $1.00 |
| Typical speed | 2.2 s / page | 1.2 s / page |
| Best for | Structured export for RAG | Handwritten text lines |
| Inputs | PDF, images, DOCX | images |
| Languages | Latin scripts, CJK | English |
| Max pages per request | 500 | 100 |
| Tables | ✓ Yes | No |
| Handwriting | No | ✓ Yes |
| Math | ✓ Yes | No |
| Bounding boxes | ✓ Yes | No |
| Confidence | No | No |
| Forms | No | No |
| Multilingual | No | No |
| On OCRRouter | Available | Available |
Prices are what you pay on OCRRouter. Speed is the provider's typical figure, not a benchmark we ran.
Which to choose
Choose Docling if
- You need one API for PDF, DOCX, PPTX, XLSX, HTML, EPUB, images, emails and XBRL.
- You want structured output (Markdown, HTML, JSON, DocTags, plain text), with lossless JSON that keeps layout, reading order and table structure.
- You want to plug in an OCR backend (EasyOCR, Tesseract, RapidOCR) or the 258M GraniteDocling VLM, and feed LangChain or LlamaIndex pipelines.
Choose TrOCR if
- You need to read English handwritten lines: the large model reports 2.89 character error rate on the IAM handwriting set, per the paper.
- You want separate checkpoints fine-tuned for handwritten (IAM), printed (SROIE) and scene text, or want to fine-tune a recognizer on your own line images.
- You want a small amount of code: it loads in a few lines with Hugging Face transformers, with an MIT licence.
Key differences
| Docling | TrOCR | |
|---|---|---|
| Input scope | Whole documents: PDF, DOCX, PPTX, XLSX, HTML, EPUB, images, emails, XBRL | Single text-line images only; needs a separate line detector |
| Output | Markdown, HTML, JSON, DocTags, plain text | Plain text; no layout, table or page-level output |
| Licence | MIT (individual models have their own licences) | MIT (microsoft/unilm repository) |
| Model size | GraniteDocling VLM option: 258M | Base 334M, large 558M |
| Benchmark | Not published | IAM handwriting CER 2.89 (TrOCR-large), reported by the authors |
| Languages | Not published | Released checkpoints are English-focused; other languages need fine-tuning |
| Known failure | Version 2.143.1 drops words and numbers with full-page Tesseract OCR (issue #5254); reading order can merge neighbouring columns (issue #5132) | Slow versus CRNN recognizers on CPU, with up to 558M parameters for one text line |
Sources
- Docling GitHub README
- Supported formats
- Issue #5254 OCR regression
- Issue #5132 reading order
- TrOCR paper (arXiv 2109.10282)
- trocr-large-handwritten model card
What each one is
TrOCR
Transformer text recognition model. Reads single text lines, including handwriting.
TrOCR detailsTry both on your own file
Run the file once with each model and compare the output.
Use one, fall back to the other
{"model": "ibm/docling","fallbacks": ["microsoft/trocr"],"file_url": "https://example.com/document.pdf"}Questions
More comparisons
Docling alternativesTrOCR alternativesBest OCR models in 2026