Fast, fully-local PDF to Markdown converter with image OCR. No API calls, runs 100% offline. Supports Python 3.9-3.12.
Project description
pdfmark-ocr
Fast, fully-local PDF → Markdown — with OCR for images. No API calls, no cloud, nothing leaves your machine.
Microsoft's markitdown only reads native text; if a PDF page is a scan or has
text inside images, you lose it. pdfmark-ocr reads native text directly (instant)
and runs OCR on embedded images, in parallel across your CPU cores.
Install
pip install pdfmark-ocr
That's it — works on Windows, macOS, and Linux (Python 3.9+). The default OCR engine is RapidOCR (ONNX, fast, small).
Usage
pdf2md document.pdf # -> full_stitched_output.md
pdf2md document.pdf -o notes.md # choose output file
pdf2md document.pdf --workers 4 # control parallelism
pdf2md document.pdf --min-image 0 # OCR every image, even tiny ones
You can also run it as a module:
python -m pdf2md_ocr document.pdf
Options
| Flag | Default | Meaning |
|---|---|---|
-o, --output |
full_stitched_output.md |
Output markdown path |
--engine |
rapidocr |
rapidocr (default) or easyocr |
--workers |
auto | Parallel page workers |
--max-dim |
1500 |
Downscale images larger than this (px) |
--min-image |
16 |
Skip images smaller than this (px); 0 keeps all |
Optional: EasyOCR engine
EasyOCR is heavier (pulls in PyTorch, hundreds of MB) but you may prefer its accuracy on some documents:
pip install "pdfmark-ocr[easyocr]"
pdf2md document.pdf --engine easyocr
How it works
- Native text is extracted directly from the PDF — instant, no OCR.
- Embedded images are downscaled and sent to the chosen OCR engine.
- Pages are processed in parallel, one OCR engine per worker process.
- A per-worker cache means repeated logos/headers are OCR'd only once.
Use from Python
from pdf2md_ocr import stitch_full_pdf
stitch_full_pdf("document.pdf", "out.md", engine="rapidocr")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdfmark_ocr-0.1.2.tar.gz.
File metadata
- Download URL: pdfmark_ocr-0.1.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a7f0e217ba4ebfaf2d2b7f3865da67a029363b47b56683dd227100f9061454
|
|
| MD5 |
115dd76eb4135be31e2e62cc23ac1d8c
|
|
| BLAKE2b-256 |
6fe07ef86644a7f875e9a110a1f6d992cee57a22c72c003d32f34185621dcf7e
|
File details
Details for the file pdfmark_ocr-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pdfmark_ocr-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
366881ead00894423074963f2df5742e2e0e5b6616f8446cca42a38ce53c7a29
|
|
| MD5 |
50ad3e5d49d098367748bfbc332b7b75
|
|
| BLAKE2b-256 |
d07a523f89949422a9944d5ed44505cba9ea3e536ff1806da3a27be88afe1837
|