The Best Open Source OCR and Document AI Tools

6 minUpdated:
The Best Open Source OCR and Document AI Tools

Use Docling or Marker to turn PDFs into clean Markdown or JSON for LLM pipelines, PaddleOCR for multilingual text recognition at scale, and Tesseract for lightweight CPU-only OCR. Test each on your hardest documents, because layout and tables decide quality more than raw character accuracy.

What is the difference between OCR and document AI?

Classic OCR turns pixels into characters. Document AI goes further: it detects layout, reading order, headings, tables, formulas and figures, then outputs structured text that keeps the meaning of the page.

For search and RAG, structure matters as much as characters. A table flattened into a line of numbers, or two columns interleaved, gives a language model nonsense even if every character is correct.

Many digital PDFs do not need OCR at all, because they contain a text layer. Good document tools detect that and only run OCR on scanned pages or images, which saves time and avoids new errors.

Which open source OCR and document AI tools lead?

ToolMain outputLicenceBest forTrade-off
Docling (IBM)Markdown, JSON, structured document modelMITEnterprise PDFs, Office files, tables into RAG pipelinesModel downloads and heavier dependencies
MarkerMarkdown, JSON, HTMLCode GPL-3.0; model weights with separate terms (check)Books, papers and PDFs to clean MarkdownCommercial terms need checking
PaddleOCRText lines, layout, tablesApache 2.0Multilingual OCR at scale, many scriptsPaddlePaddle framework to learn
TesseractPlain text, hOCR, searchable PDFApache 2.0CPU-only OCR of clean scans, huge language listWeak on complex layouts and handwriting
SuryaText lines, layout, reading orderCode GPL-3.0; model weights with separate terms (check)Layout-aware OCR across many languagesGPU recommended, licence nuances
MinerUMarkdown, JSONCheck the licence fileScientific and technical PDFs with formulasHeavier setup
OCRmyPDFPDF with text layerMPL-2.0Making scanned PDF archives searchableUses Tesseract, no deep layout analysis

Docling or Marker: which converter should you use?

Docling, released by IBM Research, converts PDF, DOCX, PPTX, HTML and images into a unified document model, then exports Markdown or JSON. Its layout and table-structure models are designed to keep tables as tables.

It also keeps provenance, such as page numbers and element positions, which lets a RAG answer cite the exact page it came from.

It integrates directly with LlamaIndex, LangChain and other frameworks, so it is a natural first choice for RAG ingestion. The permissive MIT licence makes it easy to adopt in commercial products.

Marker focuses on producing clean, readable Markdown from PDFs, books and papers, including equations, headers and footnotes handled sensibly. It can optionally use an LLM to improve difficult pages such as complex tables.

Its code licence is GPL-3.0, and its models come with separate terms that the maintainers describe in the repository. Read them before building a commercial service on it.

PaddleOCR vs Tesseract: which for raw text recognition?

Tesseract is the veteran: a C++ engine with an LSTM recognizer, dozens of trained languages and no GPU requirement. It is excellent for clean, printed, single-column scans and is available in every Linux distribution.

PaddleOCR uses modern deep learning models for detection and recognition, with strong support for Chinese, Japanese, Korean and many other scripts, plus layout and table modules. It handles photos, receipts and skewed scans far better than Tesseract.

A practical rule: start with Tesseract for simple, clean archives on CPU, and move to PaddleOCR or Surya when documents are messy, multilingual or photographed.

Surya, from the same author as Marker, provides the OCR and layout detection under the hood and can also be used on its own when you need line-level text with reading order rather than full Markdown conversion.

What about vision-language models for OCR?

Open vision-language models, such as Qwen’s VL family and specialized OCR models built on them, can read a page image and output Markdown directly. They handle unusual layouts and handwriting better than many classic pipelines.

The trade-offs are speed, GPU cost and occasional hallucinated text that looks plausible. Use them for hard pages, and keep a classic pipeline for high-volume, well-structured documents where predictability matters.

Which tool fits which document type?

Real archives mix document types, and one tool rarely handles all of them best. A small routing step that detects whether a page has a text layer, is a scan or is a photo lets you send each page to the right engine.

The table gives sensible starting points. Treat it as a hypothesis to test on your own sample pages, not a final answer.

Document typeStarting pointWhy
Digital reports and manualsDoclingUses the text layer and keeps tables and headings
Academic papers and booksMarker or MinerUHandles equations, footnotes and long structure
Clean printed scansTesseract via OCRmyPDFFast on CPU, searchable PDF output
Photos, receipts, skewed pagesPaddleOCRRobust detection on imperfect images
Multilingual layoutsSurya or PaddleOCRBroad script support with reading order
Handwriting and unusual layoutsA vision-language modelReads context rather than isolated characters

How to choose an OCR stack step by step

  • Sort your documents into types: digital PDFs, clean scans, photos, forms, tables, handwriting.
  • Pick 30 representative pages, including the ugliest, and create reference outputs by hand.
  • Run Docling and Marker on digital and mixed PDFs; run Tesseract, PaddleOCR and Surya on scans and photos.
  • Compare both text accuracy and structure: reading order, tables, headings and lists.
  • Measure speed per page on your real hardware, CPU and GPU, at your expected volume.
  • Check licences for code and weights, especially for Marker and Surya in commercial use.

Where OCR pipelines break

Keep the intermediate Markdown or JSON for every document. When an answer is wrong downstream, you can then see whether the problem started at extraction.

  • Running OCR on digital PDFs that already have a text layer and introducing new errors.
  • Low-resolution scans; aim for roughly 300 DPI for printed text before blaming the engine.
  • Tables flattened into text, destroying the relationships an LLM needs to answer questions.
  • Mixed-language pages processed with a single language setting.
  • No confidence thresholds, so garbage text flows silently into search indexes.
  • Headers, footers and page numbers repeated inside every chunk of a RAG index.

How do you run document AI at scale inside an LLM product?

Batch conversion of thousands of documents is a queue problem more than a model problem. Put files in object storage, push page-level jobs to a queue and run workers sized to your GPU or CPU capacity, so one huge PDF cannot block everything else.

Cache results by file hash. Re-processing unchanged documents after every deployment wastes hours, while a hash lookup makes re-runs almost free and lets you reprocess only when you upgrade the model.

Track quality over time with a small fixed test set of pages. Run it whenever you upgrade a tool or model, because document AI releases can improve one layout type while regressing another.

Most RAG and extraction products start with conversion to Markdown or JSON, then chunking, embedding and retrieval. The conversion step deserves the most testing, because every later stage inherits its mistakes.

For structured extraction, such as invoices or contracts, combine a document tool for layout with an LLM that fills a schema, and validate fields with rules. RepoLoot’s catalog lists document AI projects with difficulty tags, useful when picking a base for such a pipeline.

  • Split large PDFs into pages or page ranges for parallel processing.
  • Record tool and model versions with each output file.
  • Flag low-confidence pages for human review instead of silently indexing them.
  • Keep original files, since better tools next year may justify a full reprocess.

Frequently asked questions

What is the best open source OCR for PDFs?
For PDFs headed into LLM or search pipelines, Docling and Marker are the strongest choices because they preserve layout, headings and tables as Markdown or JSON. For making scanned PDF archives searchable, OCRmyPDF with Tesseract is simple and reliable. Test on your own hardest documents.
Is Tesseract still good enough in 2026?
For clean, printed, single-column scans, yes: it is fast, runs on CPU and supports many languages. It struggles with complex layouts, photos, tables and handwriting. For those, PaddleOCR, Surya or a document tool such as Docling generally produce much better results.
Which OCR tool handles tables best?
Docling has dedicated table-structure models and exports tables in structured form, and Marker handles tables well, optionally with LLM help. PaddleOCR also includes a table recognition module. Complex merged cells remain hard for every tool, so review a sample of outputs manually.
Can I use Marker commercially?
Marker’s code is GPL-3.0, and its model weights have separate terms described by the maintainers, which may restrict some commercial uses. Read the licence section in the repository before building a paid product, or choose a permissively licensed alternative such as Docling.
Free for builders

Get a hand-picked shortlist of repos for your project

Tell us what you are building. A person — not a bot — reviews it and replies within 48 hours with the catalog projects that fit, including licence and difficulty notes.

We use your email only for this request. Privacy policy

Related guides