Repository navigation
Does markitdown support scanned PDF's? #1361
Replies: 5 comments 2 replies
|
Perhaps PaddleOCR is a better choice, as it can achieve state-of-the-art accuracy in the analysis of scanned PDFs. https://www.paddleocr.ai/latest/en/version3.x/algorithm/PP-StructureV3/PP-StructureV3.html |
|
markitdown uses pdfminer under the hood, which only reads text that is actually encoded in the PDF. For scanned PDFs (images of pages), there is no embedded text, so markitdown will return empty or minimal output - this is a pdfminer limitation, not a markitdown one. To handle scanned PDFs you need to run OCR first and produce a searchable PDF, then pass that through markitdown. Common options:
Once you have a searchable PDF with embedded text, markitdown converts it cleanly. |
|
Also, it seems that since March, markitdown supports an OCR plugin. Here is the README for the plugin. Note: You will need to supply your own API key for an LLM provider (like OpenAI) for it to work. |
|
Small update for anyone finding this now: MarkItDown does support OCR for scanned PDFs through the Install it with: pip install markitdown-ocr
pip install openaiThen enable plugins and provide an LLM client/model: from markitdown import MarkItDown
from openai import OpenAI
md = MarkItDown(
enable_plugins=True,
llm_client=OpenAI(),
llm_model="gpt-4o",
)
result = md.convert("scanned.pdf")
print(result.markdown)According to the current MarkItDown documentation, the OCR plugin works with PDFs as well as DOCX, PPTX and XLSX files and extracts text from embedded images. Without an So for scanned/image-only PDFs, using the OCR plugin is now the built-in MarkItDown ecosystem solution rather than needing to OCR the PDF separately first. |
|
Yes, MarkItDown can handle scanned PDFs, but OCR is required because scanned PDFs contain images rather than actual text. The markitdown-ocr plugin can perform OCR on scanned pages using an LLM vision model. For normal PDFs, MarkItDown extracts the embedded text directly; for scanned PDFs, the OCR plugin extracts the text from the page images. |
Uh oh!
There was an error while loading. Please reload this page.
I'm working on a program that rename's documents based on the files metadata, as well as context extracted from PDF's. PyPDF works well enough for Pnative PDF's but struggles with anything scanned. How does this handle scanned documents?
All reactions