Formats

OCR with MarkItDown: how to convert scanned PDFs and images

Updated 2026-11-15·Upstream source ↗
Markdown view

MarkItDown reads text that is already in a file; it cannot read text that is only pixels. A scanned PDF therefore converts with exit code 0 and no output at all. We generated nine scans with known text and ran three routes on them: nothing, an OCR pass before MarkItDown, and the markitdown-ocr plugin driven by two local vision models.

Short answer

MarkItDown has no built-in OCR, and empty output is the symptom. In our tests the route that worked best on a CPU-only machine was to add a text layer first with OCRmyPDF and Tesseract, then run MarkItDown: 5.6% to 8.5% character error on clean 300 dpi scans in five languages, about 2.6 seconds per page, no model download.

The command is in route 1 below.

The plugin route works only with a vision model you supply, and the two small local models we tried were slower and, in our runs, less accurate. We did not test hosted models or Azure.

Tested with markitdown 0.1.9 · Python markitdown 0.1.9 + markitdown-ocr 0.1.2 · Ubuntu 24.04 CI runner, 4 CPU cores, no GPU · Ollama 0.40 with moondream and qwen2.5vl:3b · OCRmyPDF 16.13 with Tesseract 5.5 (T11) · 2026-11-15 · evidence: ocr-results.csv, ocr-results.json, t11.log

How to tell whether your file needs OCR

  1. Select text in a PDF viewer. If you cannot, the page is an image.
  2. Look at MarkItDown's output. All eight of our single-page scans produced zero characters and exit code 0:
Plain MarkItDown on scanned pages (character error 1.0 means nothing was recovered)
FileLanguageOutput charactersCharacter error
scan-en-300dpi.pdfen01.0
scan-es-300dpi.pdfes01.0
scan-de-300dpi.pdfde01.0
scan-ru-300dpi.pdfru01.0
scan-zh-300dpi.pdfzh01.0
scan-en-100dpi.pdfen01.0
photo-en.pdfen01.0
scan-table-300dpi.pdfen01.0
mixed.pdfen330.853
Plain MarkItDown on scanned pages (character error 1.0 means nothing was recovered) Source: Test T11 · markitdown 0.1.9 · 2026-11-15 · ocr-results.csv · Download CSV
  1. Watch for the mixed case. Our two-page file with a real text page and a scanned page produced only the first page's sentence (33 characters), with no hint that page two was dropped. That is the case people miss (PDF page).

The browser converter reports "no text layer" for such files instead of returning nothing.

The routes we measured

Character error is the edit distance to the known text, ignoring case, spaces, and markup, divided by the length of the known text (lower is better). Every file is a page we generated, so the true text is known. One run each; the machine was a shared CI runner, so treat seconds as an order of magnitude.

Every route on every scan: character error, output size, seconds per page and whether a pipe table came out
RouteFileCharacter errorCharactersSeconds per pageTable
plain MarkItDownscan-en-300dpi.pdf1.000.0no
plain MarkItDownscan-es-300dpi.pdf1.000.0no
plain MarkItDownscan-de-300dpi.pdf1.000.0no
plain MarkItDownscan-ru-300dpi.pdf1.000.0no
plain MarkItDownscan-zh-300dpi.pdf1.000.0no
plain MarkItDownscan-en-100dpi.pdf1.000.0no
plain MarkItDownphoto-en.pdf1.000.0no
plain MarkItDownscan-table-300dpi.pdf1.000.0no
plain MarkItDownmixed.pdf0.853330.0no
OCRmyPDF + Tesseract, then MarkItDownscan-en-300dpi.pdf0.0582022.7no
OCRmyPDF + Tesseract, then MarkItDownscan-es-300dpi.pdf0.0562072.6no
OCRmyPDF + Tesseract, then MarkItDownscan-de-300dpi.pdf0.0582012.6no
OCRmyPDF + Tesseract, then MarkItDownscan-ru-300dpi.pdf0.081872.6no
OCRmyPDF + Tesseract, then MarkItDownscan-zh-300dpi.pdf0.085632.6yes
OCRmyPDF + Tesseract, then MarkItDownscan-en-100dpi.pdf0.0582021.2no
OCRmyPDF + Tesseract, then MarkItDownphoto-en.pdf0.4612043.5yes
OCRmyPDF + Tesseract, then MarkItDownscan-table-300dpi.pdf0.169762.4yes
OCRmyPDF + Tesseract, then MarkItDownmixed.pdf0.0492350.8no
markitdown-ocr plugin + moondreamscan-en-300dpi.pdf2.06854427.9no
markitdown-ocr plugin + moondreamscan-es-300dpi.pdf1.28133122.9no
markitdown-ocr plugin + moondreamscan-de-300dpi.pdf1.17431725.0no
markitdown-ocr plugin + moondreamscan-zh-300dpi.pdf5.20330723.0no
markitdown-ocr plugin + moondreamscan-en-100dpi.pdf1.17333722.5no
markitdown-ocr plugin + moondreamphoto-en.pdf1.06834823.1no
markitdown-ocr plugin + moondreamscan-table-300dpi.pdf5.64640123.9no
markitdown-ocr plugin + moondreammixed.pdf1.28148312.1no
markitdown-ocr plugin + qwen2.5vl:3bscan-en-300dpi.pdf0.702112420.0no
markitdown-ocr plugin + qwen2.5vl:3bscan-es-300dpi.pdf0.77676411.9no
markitdown-ocr plugin + qwen2.5vl:3bscan-de-300dpi.pdf0.76878411.4no
markitdown-ocr plugin + qwen2.5vl:3bscan-zh-300dpi.pdf0.83151412.7no
markitdown-ocr plugin + qwen2.5vl:3bscan-en-100dpi.pdf0.14721999.2no
markitdown-ocr plugin + qwen2.5vl:3bphoto-en.pdf0.702112415.1no
markitdown-ocr plugin + qwen2.5vl:3bscan-table-300dpi.pdf0.87758413.5no
markitdown-ocr plugin + qwen2.5vl:3bmixed.pdf0.147257125.4no
markitdown-ocr plugin without an LLM clientscan-en-300dpi.pdf0.97950.0no
Every route on every scan: character error, output size, seconds per page and whether a pipe table came out Source: Test T11 · 9 scans · 4-core CPU runner · 2026-11-15 · ocr-results.csv · Download CSV
RouteWhere the page goesTested by us
Plain MarkItDownNowhere; nothing is readYes
OCRmyPDF + Tesseract, then MarkItDownStays on your machineYes
markitdown-ocr + a local vision model (Ollama)Stays on your machineYes: moondream and qwen2.5vl:3b
markitdown-ocr + a hosted vision modelSent to that providerNo
Azure Document IntelligenceSent to Microsoft's cloud serviceNo (no account)

We have no accuracy, cost or speed figures for the last two rows and give none.

Route 1: OCRmyPDF, then MarkItDown

Installing Tesseract and its language packs is covered at tesseractocr.org, another site of ours. OCRmyPDF runs Tesseract and writes the recognised text into the PDF as an invisible layer, which MarkItDown then reads like any text PDF.

Command
ocrmypdf --force-ocr -l eng --output-type pdf scan.pdf scan-ocr.pdf
markitdown scan-ocr.pdf -o scan.md

What we saw (--force-ocr, the matching Tesseract language pack for each file):

  • English, Spanish, German, Russian, Chinese at 300 dpi: 5.6% to 8.5% character error, about 2.6 seconds per page.
  • 100 dpi English: 5.8%, so a low-resolution scan was no worse here.
  • A blurred, tilted, noisy "photo" page: 46% error. Tesseract struggles with phone photos; do not expect a scan result.
  • The mixed file: 4.9% error, both pages recovered.
  • Tables: our scanned three-column table came back as a pipe table with the right cells (16.9% error; we did not break down where the errors came from), because MarkItDown's table detection works on aligned words and the OCR layer provides them (tables in PDFs). Do not generalise from one table.
A scanned table after OCRmyPDF
Pilot Report
| Station | Rainfall | Uptime |
| ------- | -------- | ------ |
| Alpha   | 412.5    | 99.2   |
| Bravo   | 388.0    | 97.8   |
| Charlie | 451.3    | 99.9   |
ocrmypdf-tesseract__scan-table-300dpi.pdf.md · 172 bytes output (.md)

For a bare image (a .png photo) MarkItDown adds nothing, so run Tesseract on it directly. We did not test that path.

Route 2: the markitdown-ocr plugin

What it is

A separate package, markitdown-ocr 0.1.2, that registers OCR-aware converters ahead of the built-in ones. It sends embedded images, and pages without text, to a vision model you configure.

Command
pip install markitdown-ocr openai

Its package pulls in PyMuPDF. PyMuPDF's own package metadata says "Dual Licensed - GNU Affero GPL 3.0 or Artifex Commercial License", which is not MarkItDown's MIT licence: check it before using the plugin in a commercial product.

Enable it: plugins and a client, from Python

Both are required. The plugin appears in the list once installed:

Command
markitdown --list-plugins
Installed MarkItDown 3rd-party Plugins:

  * ocr             	(package: markitdown_ocr)

The command line has --use-plugins but no option to pass a model client (CLI page), so OCR is a Python-API job:

Configocr_plugin.py
from openai import OpenAI
from markitdown import MarkItDown

client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
md = MarkItDown(enable_plugins=True, llm_client=client, llm_model="qwen2.5vl:3b")
print(md.convert("scan.pdf").markdown)

The silent-skip trap

With plugins enabled but no LLM client, nothing complains. Our scanned page came back as the five characters ## Page 1 and nothing else:

Plugin enabled, no client
## Page 1
markitdown-ocr-plugin-without-an-LLM-client__scan-en-300dpi.pdf.md · 9 bytes output (.md)

If you see only page headings, the client or model is missing.

What the output looks like

OCR text is wrapped in *[Image OCR] and [End OCR]* markers under a ## Page n heading. With a model that follows the task, you get the text:

qwen2.5vl:3b on a 100 dpi scan
## Page 1

*[Image OCR]
Pilot Report

Field Station Alpha reported steady rainfall across the three sites during spring. Sensors logged readings every ten minutes and the data were averaged per day. Two stations need new batteries before the summer survey begins.
[End OCR]*
plugin-qwen25vl__scan-en-100dpi.pdf.md · 274 bytes output (.md)

Two small local models, measured

Both ran through Ollama's OpenAI-compatible endpoint on four CPU cores, with no GPU.

  • moondream took about 22 to 28 seconds a page but described the page instead of reading it ("The image shows a white piece of paper with black text on it..."), so character error was 107% to 565%. It is not an OCR model.
  • qwen2.5vl:3b transcribed the title and the text, and was slow. On the 100 dpi scan it was complete (14.7% error, 99 seconds). On the 300 dpi scans it took about 410 seconds a page, and the output stopped after a few words, so error was 70% to 88%. We did not find out why the large images were cut short; it may be image size against a CPU runner, so try a lower resolution or a bigger machine.
moondream on the 300 dpi scan
## Page 1

*[Image OCR]
The image shows a white piece of paper with black text on it. The text appears to be a report or summary about a pilot's report. The report discusses the field station Alpha, which is reporting steady rainfall across the three sites during the spring. The report also mentions that the data were averaged over ten minutes and that two stations need new batteries before the summer survey begins. The report is written in a formal style, and it provides information about the field station Alpha's performance during the spring season.

The paper is placed on a desk, and the text is clearly visible, making it easy to read and understand.
[End OCR]*
plugin-moondream__scan-en-300dpi.pdf.md · 673 bytes output (.md)

The result for this plugin depends almost entirely on the model. Setting up clients and models is on the LLM page; we did not measure hosted models.

Known problems we did not re-test

We did not check Word, PowerPoint or Excel files with embedded pictures, scanned Office documents, or the plugin's behaviour through the MCP server. The upstream README is the source for those.

Which route should you pick?

SituationWhat our numbers support
The pages must stay on your machine, no GPUOCRmyPDF + Tesseract, then MarkItDown
You need tables from a scanOCRmyPDF first; check the table, since we tested one
A phone photoExpect poor results from every route we tried; retake the picture
You want a model to do itTest your own model on a sample first: our two small ones failed on 300 dpi pages
Azure or a hosted modelWe have no measurements

Cost and privacy

The two tested routes that work cost no money and send nothing off your machine. The price is time: 2.6 seconds a page for Tesseract against 100 to 410 seconds for qwen2.5vl:3b on four CPU cores. We did not price hosted routes, and prices change, so we publish none.