Layered OCR workhorse: extract text from scanned PDFs and images (tesseract, PyMuPDF, easyocr, paddleocr, vision-api).
Project description
pro-ledin-ocr
Layered OCR workhorse: extract text from scanned PDFs and images (PNG/JPG/TIFF/ HEIC/WEBP) using a tiered engine stack. The baseline path (poppler + tesseract) needs zero extra Python installs; heavier engines are opt-in extras.
- Import name:
pro.ledin.ocr - Console scripts:
ocr,ocr-probe - PyPI:
pro-ledin-ocr
Install
pip install pro-ledin-ocr # baseline
pip install "pro-ledin-ocr[vision]" # + OpenAI-compatible vision-api engine
pip install "pro-ledin-ocr[all]" # + pymupdf, opencv, easyocr, paddleocr
System binaries required for the local path: poppler (pdftoppm, pdftotext,
pdfinfo) and tesseract (with language packs).
brew install poppler tesseract tesseract-lang # macOS
sudo apt install poppler-utils tesseract-ocr-all # Debian/Ubuntu
CLI
ocr-probe myfile.pdf # triage: does it need OCR?
ocr myfile.pdf --format all # md + txt + json
ocr scan.png --format md
ocr russian_doc.pdf --lang rus+eng --format md
ocr scan.pdf --preprocess full # deskew + denoise
ocr slides.pdf --engine vision --pages 9,12 # hand pages to a multimodal agent
ocr table.png --engine vision \
--vision-prompt "Extract only table rows and preserve empty cells"
ocr slides.pdf --engine vision-api \
--vision-api-url https://api.example.com/v1 \
--vision-api-key "$KEY" --vision-model my-vision-model \
--vision-prompt-file prompts/faithful-ocr.txt
See ocr --help for the full flag reference.
Library
from pro.ledin import ocr
pages = ocr.recognize(
"scan.pdf",
ocr.RecognizeOptions(
engine="vision-api",
vision_api_key="key",
vision_model="model",
vision_prompt="Preserve checkbox states and labels.",
),
)
markdown = ocr.to_markdown(pages, "scan.pdf")
recognize() never calls sys.exit(); catch ocr.OcrError for recoverable
failures (unsupported input, missing binaries/packages, vision-api config).
Engine tiers
| Tier | Engine | Best for | Cost |
|---|---|---|---|
| 0 | pdftotext / PyMuPDF | Real text layers | Free, instant |
| 1 | tesseract (default) | Clean scans, typed text, 160+ languages | Free |
| 2 | easyocr | Handwriting, degraded scans | Free, heavy |
| 2.5 | paddleocr | CJK, multilingual, angled text | Free |
| 3 | vision (agent reads PNGs) | Tables, charts, complex layouts | Agent tokens |
| 3.5 | vision-api (OpenAI-compatible) | Headless batch, complex layouts | API cost |
Full docs: skills/ocr/SKILL.md, skills/ocr/references/engines.md,
skills/ocr/references/troubleshooting.md.
Development
uv sync --extra dev
uv run --extra dev pytest
uv build
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
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 pro_ledin_ocr-0.2.0.tar.gz.
File metadata
- Download URL: pro_ledin_ocr-0.2.0.tar.gz
- Upload date:
- Size: 39.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76aa87636101cc4f86fb577d8a4b513a380670b7a19df00b21ea4286a4e759bf
|
|
| MD5 |
e7eb640ed72dba24fcced060abda5aef
|
|
| BLAKE2b-256 |
26beaac62fd6ca5acdba9ee35a7983c43a8d5f7c5e48448f743d7ef2a4baf755
|
File details
Details for the file pro_ledin_ocr-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pro_ledin_ocr-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bddd8be13217ca15c75d7f3a2184b5bbae4727b0ce6430d4e3883fd36eaf8427
|
|
| MD5 |
068ee545315cc7dfbc997f7bd5600d1b
|
|
| BLAKE2b-256 |
2867f32cbe7f9eafc3923f4b4b86bddbd828f7131eb0c66ab1bcc4328f544e1e
|