Skip to main content

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 slides.pdf --engine vision-api \
  --vision-api-url https://api.example.com/v1 \
  --vision-api-key "$KEY" --vision-model my-vision-model

See ocr --help for the full flag reference.

Library

from pro.ledin import ocr

pages = ocr.recognize("scan.pdf", ocr.RecognizeOptions(engine="tesseract", lang="rus+eng"))
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: SKILL.md, references/engines.md, 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

pro_ledin_ocr-0.1.0.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

pro_ledin_ocr-0.1.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file pro_ledin_ocr-0.1.0.tar.gz.

File metadata

  • Download URL: pro_ledin_ocr-0.1.0.tar.gz
  • Upload date:
  • Size: 37.0 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

Hashes for pro_ledin_ocr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6959ca98696eafc1ccb2d89367e7b65b9821df9dca2dc2035e17d195b18898c9
MD5 984bd556aaacddfa2246415cdff0659c
BLAKE2b-256 d0674318007fea4c019076b9f578da03446d4e032b461f2a1d48113bd197e0f3

See more details on using hashes here.

File details

Details for the file pro_ledin_ocr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pro_ledin_ocr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 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

Hashes for pro_ledin_ocr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab7f7104f388baec2e35f358b6c15c64ed4ead73cb7863f5d6c92d85b0118c16
MD5 016ec742f56690a84efcffd7f32c3bab
BLAKE2b-256 c4c465b241106a2c671fe0d300c6019e80276f2f53f0e21c3a7bde2b76d188fc

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