claude-pdf2md-ocr
OCR plugin for claude-pdf2md.
Detects PDF pages that have no usable text layer (pure scans, hybrid scans
with minimal overlay) and fills them in using Tesseract, so that the
existing claude-pdf2md pipeline — headings, lists, tables, links — works
on scanned documents the same way it works on native PDFs.
Features
- Auto language detection. Sniffs the document's text layer (or a cheap
first-pass OCR probe when the text layer is missing) and picks a narrow
Tesseract pack like
ces+engorukr+eng. Avoids the cross-script confusion that plagues a defaultukr+rus+engmodel on Czech or English documents. - Post-OCR spellcheck. Cleans up the cross-script errors that do slip
through (
опе → one,Ме → №,Мо1224 → №1224,ІВАМ → IBAN,І → I) by running each token against a language-awarewordfreqdictionary. Conservative — only edits a token when the correction is unambiguous. - Smart page selection. By default OCR runs only on pages that are
scans (no text layer, or a whole-page background image + tiny text
overlay).
--all-pagesforces it on every page. - Heading-safe injection. OCR word heights are normalised to a per-page median so the base pipeline's heading detector stops treating every line with tall capitals as a tier-2 heading.
System dependency
Tesseract must be installed separately.
macOS
brew install tesseract tesseract-lang # ships 100+ language packs
tesseract --list-langs | grep -E '^(ukr|rus|ces|eng)$'
Debian / Ubuntu
sudo apt-get install tesseract-ocr tesseract-ocr-ukr tesseract-ocr-rus \
tesseract-ocr-ces tesseract-ocr-eng
tesseract --list-langs | grep -E '^(ukr|rus|ces|eng)$'
Windows
-
Download the UB Mannheim Tesseract installer: https://github.com/UB-Mannheim/tesseract/wiki (64-bit recommended).
-
During installation, expand "Additional language data (download)" and tick Ukrainian, Russian, Czech, English (or whichever languages your documents use).
-
Add the install directory to
PATH(default:C:\Program Files\Tesseract-OCR). The installer offers a checkbox; if missed, set it manually in System Properties → Environment Variables. -
Verify in a fresh PowerShell:
tesseract --version tesseract --list-langs
Install
macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install claude-pdf2md-ocr # once on PyPI
# or, while the package is still a prototype:
pip install git+https://github.com/skippdot/claude-pdf2md-ocr
Windows
# Python 3.10+ from python.org with "Add Python to PATH" checked
py -m venv .venv
.venv\Scripts\Activate.ps1
pip install claude-pdf2md-ocr
# or the git variant:
pip install git+https://github.com/skippdot/claude-pdf2md-ocr
Usage
# Auto language detection (default). Tesseract gets a narrow pack based on
# the PDF's text layer or a cheap probe pass.
claude-pdf2md-ocr scan.pdf -o out.md
# Force an explicit Tesseract language string when you know the document:
claude-pdf2md-ocr scan.pdf -o out.md --lang ces+eng
# OCR every page, even those that already have a text layer:
claude-pdf2md-ocr scan.pdf -o out.md --all-pages
# Skip the post-OCR spellcheck pass:
claude-pdf2md-ocr scan.pdf -o out.md --no-spellcheck
Or programmatically:
from claude_pdf2md_ocr import convert_with_ocr
md = convert_with_ocr("scan.pdf") # auto-detect lang
md = convert_with_ocr("scan.pdf", lang="ces+eng") # explicit override
Status
Prototype. Published to PyPI once accuracy on real scanned Ukrainian /
Czech legal documents stabilises and the base claude-pdf2md package
grows the enrichers= hook that will collapse this package's bespoke
pipeline composition into a one-liner.
Metadata
Release files for claude-pdf2md-ocr 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_pdf2md_ocr-0.0.2.tar.gz | 17.8 kB | With provenance | Details for claude_pdf2md_ocr-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_pdf2md_ocr-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for claude_pdf2md_ocr-0.0.2-py3-none-any.whl |
Total release size: 35.3 kB
Release files / claude_pdf2md_ocr-0.0.2.tar.gz
| Download URL | claude_pdf2md_ocr-0.0.2.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e89c0aec4c6b217d47594057f17c325de7e54c0b2d49a0d5414b942bfb62d87d
|
|
BLAKE2b-256 checksum How to use checksums |
bf154d4d7a8e3d3c947b5db3421f9ae2f03a18ffabf12b8179c4d19e75288ca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logRelease files / claude_pdf2md_ocr-0.0.2-py3-none-any.whl
| Download URL | claude_pdf2md_ocr-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a36fe54288a62bbd0c2af1aa5f88da7a648cc03301f9cc351c1539237e697bb
|
|
BLAKE2b-256 checksum How to use checksums |
f801e97814f47d1373148bd964ad74bf48b74b1770968ac3ec7b12dad67e11e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logSecurity for claude-pdf2md-ocr 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for claude_pdf2md_ocr-0.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.