Skip to main content

ocrmypdf-docling

An OCRmyPDF plugin that sends page images to Docling Serve and embeds the recognized words as a searchable text layer. It uses the DCC word-box extension to position individual words in the PDF.

For tables, the plugin uses Docling's row and column order when writing the PDF text layer and the plain-text sidecar. It uses DCC word positions and measures line height and baseline from the page image. The Docling response is used during conversion only.

Run Docling Serve

Start the DCC image on the same machine for a CPU setup. It includes Docling Serve, the word-box extension, and the pp-ocrv6 preset.

docker run --rm -p 127.0.0.1:5001:5001 \
  -e DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS=true \
  -e DOCLING_SERVE_ENG_LOC_NUM_WORKERS=1 \
  -e DOCLING_DEVICE=cpu \
  ghcr.io/dcc-bs/dcc-docling-serve-cpu:v1.38.2

Wait for http://127.0.0.1:5001/health to respond. For CUDA, use a DCC CUDA image and configure GPU access on the server.

Use the plugin

Install OCRmyPDF and the plugin in the same tool environment.

uv tool install --python 3.14 --with ocrmypdf-docling ocrmypdf
ocrmypdf --docling -l pol --sidecar output.txt input.pdf output.pdf

From this repository, install with uv sync --locked and run OCRmyPDF with uv run.

uv run ocrmypdf --docling -l pol --sidecar output.txt input.pdf output.pdf

For a remote deployment, specify its base URL. Presets must provide OCR line and word boxes through DCC.

uv run ocrmypdf --docling --docling-url https://docling.example.com \
  --docling-preset pp-ocrv6 --docling-timeout 120 -l pol input.pdf output.pdf

Set DOCLING_SERVE_API_KEY in the client environment if the server requires authentication. Each page image is sent to the configured server. --jobs controls how many pages OCRmyPDF can submit concurrently. Use the default renderer or --pdf-renderer fpdf2. Rotation and deskew should be handled before running this adapter.

The Python API accepts the same settings.

import ocrmypdf

ocrmypdf.ocr(
    "input.pdf",
    "output.pdf",
    ocr_engine="docling",
    languages=["pol"],
    docling_url="http://127.0.0.1:5001",
)

Metadata

Release files for ocrmypdf-docling 1.0.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 ocrmypdf-docling 1.0.0
File Size Uploaded Provenance Actions
ocrmypdf_docling-1.0.0.tar.gz 10.2 kB Without provenance Details for ocrmypdf_docling-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocrmypdf-docling 1.0.0
File Interpreter ABI Platform Actions
ocrmypdf_docling-1.0.0-py3-none-any.whl Python 3 none any Details for ocrmypdf_docling-1.0.0-py3-none-any.whl

Total release size: 22.6 kB

Release files / ocrmypdf_docling-1.0.0.tar.gz

Download URL ocrmypdf_docling-1.0.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0107ca74a298e9d3c95de7f414fb3b41098ee8cbfdebed5b0abfb36b3222e73f
BLAKE2b-256 checksum
How to use checksums
4af877be568b01064a17eca5cf8fe901811b4b818ba5149e6e1c8848af132a1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ocrmypdf_docling-1.0.0-py3-none-any.whl

Download URL ocrmypdf_docling-1.0.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2723f2834b3f7c57b9ebe977828dfe28a0d58ce839a3716d9a8d694a60c1f153
BLAKE2b-256 checksum
How to use checksums
b8f6b3eb2d1d0fa6642f62da4d9db0845b96547779ec5d8289e1b1997265c044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

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