Skip to main content

Marker OCR CLI

CI PyPI version Python 3.11+ License: MIT

A command-line tool for OCR processing using Marker's layout-aware pipeline. Extract text, equations, tables, and figures from PDFs with high accuracy.

Installation

Requires Python 3.11+ and a GPU (recommended).

pip install marker-ocr-cli

Or from source:

git clone https://github.com/r-uben/marker-ocr-cli.git
cd marker-ocr-cli
uv sync

Quick start

# Process a single file
marker-ocr paper.pdf

# Process a directory
marker-ocr ./papers/ -o ./results/

# Preview what would be processed (no model loading)
marker-ocr ./papers/ --dry-run

# Process specific pages
marker-ocr paper.pdf --pages 0-5

# Force OCR on all pages
marker-ocr paper.pdf --force-ocr

Options

Usage: marker-ocr [OPTIONS] INPUT_PATH

Options:
  -o, --output-dir PATH           Output directory (default: <input_dir>/marker_ocr_output/)
  --pages TEXT                    Page range (e.g., '0-5' or '1,3,5')
  --force-ocr                     Force OCR on all pages regardless of embedded text

  --device [auto|cpu|cuda|mps]    Inference device (default: cpu on Apple Silicon)
  --reprocess                     Reprocess already-processed files
  --dry-run                       List files without loading models
  -q, --quiet                     Suppress all output except errors
  -v, --verbose                   Enable verbose/debug output
  --info                          Show system and device info
  --version                       Show version
  --help                          Show this message

Output structure

marker_ocr_output/
├── document_name/
│   ├── document_name.md        # OCR markdown (clean text only)
│   └── figures/                # extracted figures
│       ├── figure_1.png
│       └── figure_2.png
├── another_document/
│   └── ...
└── metadata.json               # processing stats, checksums, file list

How it works

Marker uses a pipeline of specialized models rather than a single end-to-end model:

  • Surya -- layout detection and reading order
  • Surya OCR -- text recognition
  • Texify -- equation detection and LaTeX conversion

This approach is faster and more accurate than single-model solutions, especially for academic papers with complex layouts, equations, and tables.

Development

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Lint
uv run ruff check .

# Format
uv run ruff format .

# Type check
uv run mypy marker_ocr/ --ignore-missing-imports

Limitations

  • Supported formats: PDF only (Marker processes PDFs natively)
  • Models: ~4-5 GB VRAM (auto-downloads on first run)
  • GPU recommended for reasonable speed (supports CUDA and MPS)

License

MIT License - see LICENSE for details.

Metadata

Release files for marker-ocr-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marker-ocr-cli 0.2.0
File Size Uploaded Provenance
marker_ocr_cli-0.2.0.tar.gz 156.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for marker-ocr-cli 0.2.0
File Interpreter ABI Platform
marker_ocr_cli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 169.1 kB

Release files / marker_ocr_cli-0.2.0.tar.gz

Download URL marker_ocr_cli-0.2.0.tar.gz
Size 156.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b005cc588549eee07f7cf553c4671c58173653fa957c5c5aa6bd0656ed5448f0
BLAKE2b-256 checksum
How to use checksums
af986b625442aa8b8797a708bdfa6d79188075ac143a66a939b140de5bedb7f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / marker_ocr_cli-0.2.0-py3-none-any.whl

Download URL marker_ocr_cli-0.2.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db2bdc345ca9065e1fe751b5ba1cfc92658f246061046237156785b48fe02230
BLAKE2b-256 checksum
How to use checksums
dd981f8a61a93fdee6a4ca1dff945065bb543e08b2655c167daf1dee7518e3c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for marker-ocr-cli 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page