ocr-pdf2md
A CLI tool that converts PDF documents to clean Markdown. Handles both digital PDFs (with extractable text) and scanned/image-based PDFs via OCR.
Installation
uv tool install ocr-pdf2md
OCR requirement
For scanned or image-based PDFs, Tesseract must be installed on your system:
- Ubuntu/Debian:
sudo apt install tesseract-ocr - macOS:
brew install tesseract - Windows: https://github.com/tesseract-ocr/tesseract
Tesseract is only invoked when a page has little or no extractable text. Fully digital PDFs work without it.
Usage
ocr-pdf2md input.pdf output.md
Features
- Extracts text from digital PDFs using pypdf
- Falls back to OCR (Tesseract) for scanned/image pages
- Detects and removes repeating headers and footers
- Identifies and reformats Table of Contents pages
- Detects headings (ALL CAPS -> H2, Title Case -> H3)
- Formats bullet and numbered lists
- Rejoins hyphenated words split across lines
- Cleans Unicode characters to ASCII equivalents
Acknowledgments
Inspired by rubysash/pdf2md. This project adds OCR support for scanned PDFs, improved type hints, and other enhancements.
License
MIT
Metadata
Release files for ocr-pdf2md 0.1.0
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 |
|---|---|---|---|---|
| ocr_pdf2md-0.1.0.tar.gz | 6.0 kB | Without provenance | Details for ocr_pdf2md-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ocr_pdf2md-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ocr_pdf2md-0.1.0-py3-none-any.whl |
Total release size: 13.2 kB
Release files / ocr_pdf2md-0.1.0.tar.gz
| Download URL | ocr_pdf2md-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86529ad337b77ebfc9d0b9d8976623d7c8ca9319baf2c3d13ca9d6a8da9e63dd
|
|
BLAKE2b-256 checksum How to use checksums |
c4df1b47c869eae8240a4b82a0e5b27553bb557285dce52c4e2812e382df5f69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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":null}
|
Release files / ocr_pdf2md-0.1.0-py3-none-any.whl
| Download URL | ocr_pdf2md-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6597018bb1366a3e2dd010a608a2a46f3b782486487415855d5d21b619cd7e8
|
|
BLAKE2b-256 checksum How to use checksums |
23d3373154b3f358c9de53312e318fb6c6f8c95c01623f0a61231052538fa83c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","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":null}
|
Security for ocr-pdf2md 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.