Skip to main content

Docling SuryaOCR Plugin

Docling plugin that brings the powerful Surya OCR engine into Docling.

License: GPL-3.0-only – must be used as an external plugin (allow_external_plugins=True).


Installation (uv)

uv pip install docling-surya

Note:

  • Supported only on Linux x86_64 (matches surya-ocr dependency).
  • Models (~1–2 GB) are downloaded automatically on first use.
  • Cached under ~/.cache/huggingface (or HF_HOME if set).

Python Usage

from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling_surya import SuryaOcrOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

pipeline_options = PdfPipelineOptions(
    do_ocr=True,
    ocr_model="suryaocr",           # Plugin engine name
    allow_external_plugins=True,     # Required for third-party plugins
    ocr_options=SuryaOcrOptions(
        lang=["en"],                 # OCR language(s)
        use_gpu=True,                # Optional: force GPU
    ),
)

converter = DocumentConverter(
    format_options={
        InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options),
        InputFormat.IMAGE: PdfFormatOption(pipeline_options=pipeline_options),
    }
)

result = converter.convert("path/to/document.pdf")
print(result.document.export_to_markdown())

CLI Usage

# List available external plugins (should show "surya-ocr")
docling --show-external-plugins

# Run conversion with Surya OCR
docling --allow-external-plugins --ocr-engine=suryaocr path/to/document.pdf

Example Script

See examples/docling_with_custom_models.py:

uv run examples/docling_with_custom_models.py

Processes a sample EPA PDF and prints Markdown output.


Development with uv

# Clone the repo
git clone https://github.com/harrykhh/docling_surya
cd docling_surya

# Create virtual environment + install deps
uv venv
uv sync --all-extras

# Run tests
uv run pytest

# Run linter
uv run ruff check .

# Build wheel
uv build

# Install locally
uv pip install dist/docling_surya_ocr-*.whl

# Publish to PyPI (requires token)
uv publish

Project Structure

docling_surya/
├── pyproject.toml
├── uv.lock
├── README.md
├── LICENSE (GPL-3.0)
├── doclin_surya/
│   ├── __init__.py
│   └── plugin.py           # Full SuryaOcrModel + factory
├── examples/
│   └── docling_with_custom_models.py
└── tests/
    └── test_surya_ocr.py

Plugin Registration

The plugin registers via:

[project.entry-points."docling"]
surya-ocr = "docling_surya.plugin"

And exports the OCR engine via:

def ocr_engines():
    return {"ocr_engines": [SuryaOcrModel]}

License & Attribution


Enjoy high-accuracy OCR on complex PDFs with Docling + Surya!

Metadata

Release files for docling-surya 0.1.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 docling-surya 0.1.0
File Size Uploaded Provenance
docling_surya-0.1.0.tar.gz 129.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docling-surya 0.1.0
File Interpreter ABI Platform
docling_surya-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 146.9 kB

Release files / docling_surya-0.1.0.tar.gz

Download URL docling_surya-0.1.0.tar.gz
Size 129.9 kB
Tags Source
SHA-256 checksum
How to use checksums
050ba967733f99da5d900d3d97bf203522b510cd698c7283b304a33b3d064df8
BLAKE2b-256 checksum
How to use checksums
5e8c0b429cee0eec4da640c52b2d05d295fb90c270071d566993bff8ec92adb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 2, 2025.

Transparency log

Release files / docling_surya-0.1.0-py3-none-any.whl

Download URL docling_surya-0.1.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06c43dd2f94d06b680e0364181c68ae297a75961412aea8822f542e7e277ee19
BLAKE2b-256 checksum
How to use checksums
4ed94875cfeb9651168eaee64ccc0345628a5cfef2691aac746aa9d97755ece8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 2, 2025.

Transparency log

Security for docling-surya 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for docling_surya-0.1.0.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 Nov 2, 2025.

Transparency log

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.1.0 This release

2 release files Full 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