Formats
OCR with MarkItDown: how to convert scanned PDFs and images
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
- Select text in a PDF viewer. If you cannot, the page is an image.
- Look at MarkItDown's output. All eight of our single-page scans produced zero characters and exit code 0:
| File | Language | Output characters | Character error |
|---|---|---|---|
scan-en-300dpi.pdf | en | 0 | 1.0 |
scan-es-300dpi.pdf | es | 0 | 1.0 |
scan-de-300dpi.pdf | de | 0 | 1.0 |
scan-ru-300dpi.pdf | ru | 0 | 1.0 |
scan-zh-300dpi.pdf | zh | 0 | 1.0 |
scan-en-100dpi.pdf | en | 0 | 1.0 |
photo-en.pdf | en | 0 | 1.0 |
scan-table-300dpi.pdf | en | 0 | 1.0 |
mixed.pdf | en | 33 | 0.853 |
- 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.
| Route | File | Character error | Characters | Seconds per page | Table |
|---|---|---|---|---|---|
| plain MarkItDown | scan-en-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-es-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-de-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-ru-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-zh-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-en-100dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | photo-en.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | scan-table-300dpi.pdf | 1.0 | 0 | 0.0 | no |
| plain MarkItDown | mixed.pdf | 0.853 | 33 | 0.0 | no |
| OCRmyPDF + Tesseract, then MarkItDown | scan-en-300dpi.pdf | 0.058 | 202 | 2.7 | no |
| OCRmyPDF + Tesseract, then MarkItDown | scan-es-300dpi.pdf | 0.056 | 207 | 2.6 | no |
| OCRmyPDF + Tesseract, then MarkItDown | scan-de-300dpi.pdf | 0.058 | 201 | 2.6 | no |
| OCRmyPDF + Tesseract, then MarkItDown | scan-ru-300dpi.pdf | 0.08 | 187 | 2.6 | no |
| OCRmyPDF + Tesseract, then MarkItDown | scan-zh-300dpi.pdf | 0.085 | 63 | 2.6 | yes |
| OCRmyPDF + Tesseract, then MarkItDown | scan-en-100dpi.pdf | 0.058 | 202 | 1.2 | no |
| OCRmyPDF + Tesseract, then MarkItDown | photo-en.pdf | 0.461 | 204 | 3.5 | yes |
| OCRmyPDF + Tesseract, then MarkItDown | scan-table-300dpi.pdf | 0.169 | 76 | 2.4 | yes |
| OCRmyPDF + Tesseract, then MarkItDown | mixed.pdf | 0.049 | 235 | 0.8 | no |
| markitdown-ocr plugin + moondream | scan-en-300dpi.pdf | 2.068 | 544 | 27.9 | no |
| markitdown-ocr plugin + moondream | scan-es-300dpi.pdf | 1.281 | 331 | 22.9 | no |
| markitdown-ocr plugin + moondream | scan-de-300dpi.pdf | 1.174 | 317 | 25.0 | no |
| markitdown-ocr plugin + moondream | scan-zh-300dpi.pdf | 5.203 | 307 | 23.0 | no |
| markitdown-ocr plugin + moondream | scan-en-100dpi.pdf | 1.173 | 337 | 22.5 | no |
| markitdown-ocr plugin + moondream | photo-en.pdf | 1.068 | 348 | 23.1 | no |
| markitdown-ocr plugin + moondream | scan-table-300dpi.pdf | 5.646 | 401 | 23.9 | no |
| markitdown-ocr plugin + moondream | mixed.pdf | 1.281 | 483 | 12.1 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-en-300dpi.pdf | 0.702 | 112 | 420.0 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-es-300dpi.pdf | 0.776 | 76 | 411.9 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-de-300dpi.pdf | 0.768 | 78 | 411.4 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-zh-300dpi.pdf | 0.831 | 51 | 412.7 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-en-100dpi.pdf | 0.147 | 219 | 99.2 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | photo-en.pdf | 0.702 | 112 | 415.1 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | scan-table-300dpi.pdf | 0.877 | 58 | 413.5 | no |
| markitdown-ocr plugin + qwen2.5vl:3b | mixed.pdf | 0.147 | 257 | 125.4 | no |
| markitdown-ocr plugin without an LLM client | scan-en-300dpi.pdf | 0.979 | 5 | 0.0 | no |
| Route | Where the page goes | Tested by us |
|---|---|---|
| Plain MarkItDown | Nowhere; nothing is read | Yes |
| OCRmyPDF + Tesseract, then MarkItDown | Stays on your machine | Yes |
markitdown-ocr + a local vision model (Ollama) | Stays on your machine | Yes: moondream and qwen2.5vl:3b |
markitdown-ocr + a hosted vision model | Sent to that provider | No |
| Azure Document Intelligence | Sent to Microsoft's cloud service | No (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.
ocrmypdf --force-ocr -l eng --output-type pdf scan.pdf scan-ocr.pdf
markitdown scan-ocr.pdf -o scan.mdWhat 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.
Pilot Report
| Station | Rainfall | Uptime |
| ------- | -------- | ------ |
| Alpha | 412.5 | 99.2 |
| Bravo | 388.0 | 97.8 |
| Charlie | 451.3 | 99.9 |Pilot Report
| Station | Rainfall | Uptime |
|---|---|---|
| Alpha | 412.5 | 99.2 |
| Bravo | 388.0 | 97.8 |
| Charlie | 451.3 | 99.9 |
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.
pip install markitdown-ocr openaiIts 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:
markitdown --list-pluginsInstalled 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:
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:
## Page 1Page 1
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:
## 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]*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]*
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.
## 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]*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]*
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?
| Situation | What our numbers support |
|---|---|
| The pages must stay on your machine, no GPU | OCRmyPDF + Tesseract, then MarkItDown |
| You need tables from a scan | OCRmyPDF first; check the table, since we tested one |
| A phone photo | Expect poor results from every route we tried; retake the picture |
| You want a model to do it | Test your own model on a sample first: our two small ones failed on 300 dpi pages |
| Azure or a hosted model | We 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.