Simple CLI tool to convert PDFs to Markdown using Marker AI
Project description
pdf2md-ocr
Simple CLI tool to convert PDFs to Markdown using Marker AI.
Quick Start
Recommended (no installation needed):
uvx pdf2md-ocr input.pdf -o output.md
Traditional installation:
pip install pdf2md-ocr
pdf2md-ocr input.pdf -o output.md
Usage
# Convert PDF to Markdown (output same name with .md extension)
pdf2md-ocr document.pdf
# Specify output file
pdf2md-ocr document.pdf -o result.md
# Convert specific page range (page numbering starts at 1)
pdf2md-ocr document.pdf --start-page 2 --end-page 5
# Convert from page 3 to the end
pdf2md-ocr document.pdf --start-page 3
# Convert from the beginning to page 10
pdf2md-ocr document.pdf --end-page 10
# Show cache location and size
pdf2md-ocr document.pdf --show-cache-info
# Show help
pdf2md-ocr --help
# Show version
pdf2md-ocr --version
Page Range Options
--start-page N: Starting page number (1-based, inclusive). If omitted, starts from page 1.--end-page M: Ending page number (1-based, inclusive). If omitted, goes to the last page.
Both options are optional and can be combined:
- Use only
--start-pageto convert from a specific page to the end. - Use only
--end-pageto convert from the beginning to a specific page. - Use both to convert a specific range.
Important: Page numbering starts at 1 (not 0).
First Run
The first time you run pdf2md-ocr, it will download ~2-3GB of AI models. These models are cached locally and reused for all future conversions.
To see where models are cached:
pdf2md-ocr input.pdf --show-cache-info
This will show the cache location and size after conversion. Cache locations, typically:
- macOS:
~/Library/Caches/datalab/models/ - Linux:
~/.cache/datalab/models/ - Windows:
%LOCALAPPDATA%\datalab\models\
To clear the cache: Simply delete the cache directory shown in the info above, or use make clean-cache if developing locally.
Subsequent runs will be much faster since the models are already cached.
Requirements
- Python 3.10 or higher
- ~2GB disk space for AI models (one-time download)
Development
For development, a Makefile is provided with common tasks:
# Install dependencies
make install-dev
# Run tests
make test
# Run tests with verbose output
make test-verbose
# Clean build artifacts
make clean
# Clear AI model cache (frees ~3GB disk space)
make clean-cache
# Build distribution packages
make build
# See all available commands
make help
How It Works
This tool is a minimal wrapper around the excellent marker-pdf library, which uses AI models to:
- Detect text, tables, and equations in PDFs
- Extract content with proper formatting
- Convert to clean Markdown
License
GPL-3.0-or-later
This project is licensed under the GNU General Public License v3.0 or later to comply with the marker-pdf library license (GPL-3.0-or-later).
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 pdf2md_ocr-1.0.0.tar.gz.
File metadata
- Download URL: pdf2md_ocr-1.0.0.tar.gz
- Upload date:
- Size: 185.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b8180d827ff40d0ae4d2e5fa06ea32b7b7faa5315d45050eaca2709c3571b30
|
|
| MD5 |
c7d7a507b71fb32cdc4858e46604d8c2
|
|
| BLAKE2b-256 |
cf6a42ce6a20e791fef495d24652dc01337a9128c513b55ba0b73dcebb457ce4
|
Provenance
The following attestation bundles were made for pdf2md_ocr-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on carloscasalar/pdf2md-ocr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdf2md_ocr-1.0.0.tar.gz -
Subject digest:
5b8180d827ff40d0ae4d2e5fa06ea32b7b7faa5315d45050eaca2709c3571b30 - Sigstore transparency entry: 763414658
- Sigstore integration time:
-
Permalink:
carloscasalar/pdf2md-ocr@4d30006d1fc4c7a22093fb939dcc0fc7408245a5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/carloscasalar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4d30006d1fc4c7a22093fb939dcc0fc7408245a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pdf2md_ocr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pdf2md_ocr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc6789ea0496416e5fa488ebc1d3b9a506c60357a021019ad9472f3c9594fafb
|
|
| MD5 |
684b0dac47ca53d549211a76cd96dada
|
|
| BLAKE2b-256 |
44b261f33f75019314e8ad9fe8a38ee93c9b81d006cea999c7e4c1706d21904a
|
Provenance
The following attestation bundles were made for pdf2md_ocr-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on carloscasalar/pdf2md-ocr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdf2md_ocr-1.0.0-py3-none-any.whl -
Subject digest:
cc6789ea0496416e5fa488ebc1d3b9a506c60357a021019ad9472f3c9594fafb - Sigstore transparency entry: 763414660
- Sigstore integration time:
-
Permalink:
carloscasalar/pdf2md-ocr@4d30006d1fc4c7a22093fb939dcc0fc7408245a5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/carloscasalar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4d30006d1fc4c7a22093fb939dcc0fc7408245a5 -
Trigger Event:
push
-
Statement type: