Skip to main content

Fast, fully-local PDF & image (PNG/JPG/...) to Markdown converter with image OCR, plus a ZIP of parsed images. 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

  1. Native text is extracted directly from the PDF — instant, no OCR.
  2. Embedded images are downscaled and sent to the chosen OCR engine.
  3. Pages are processed in parallel, one OCR engine per worker process.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfmark_ocr-0.2.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfmark_ocr-0.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pdfmark_ocr-0.2.0.tar.gz.

File metadata

  • Download URL: pdfmark_ocr-0.2.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for pdfmark_ocr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dc7561e54fffbee03d5b2cb2d802caa403d57378fa7003b560235780b13b8e50
MD5 1d9e78b703e4a217ab03d7f049eca674
BLAKE2b-256 365319bac5d7d7df150b39043e6dc39320bd831b4085a7d23bfdc7cf8afcd7be

See more details on using hashes here.

File details

Details for the file pdfmark_ocr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pdfmark_ocr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for pdfmark_ocr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a510c60f83aa69c15a851c3571cc87b7580e260132de0bda3fba19299f77de4d
MD5 307cc1e2e0077e8db8729477cea7c610
BLAKE2b-256 28373661dff2505f8328a078d45475037ca661711b4ee87672d6acaf390d46f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page