docling-parse 7.28.0


pip install docling-parse

  Latest version

Released: Nov 24, 2026


Meta
Author: Peter Staar, Christoph Auer, Michele Dolfi, Panos Vagenas, Maxim Lysak
Requires Python: >=3.10

Classifiers

Operating System
  • MacOS :: MacOS X
  • POSIX :: Linux
  • Microsoft :: Windows

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers
  • Science/Research

Programming Language
  • C++
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15

Docling Parse

PyPI version PyPI - Python Version uv Pybind11 Platforms License MIT

Simple package to extract text, paths and bitmap images with coordinates from programmatic PDFs. This package is used in the Docling PDF conversion. Below, we show a few output of the latest parser with char, word and line level output for text, in addition to the extracted paths and bitmap resources.

To do the visualizations yourself, simply run (change word into char or line),

uv run python ./docling_parse/visualize.py -i <path-to-pdf-file> -c word --interactive
original char word line
screenshot screenshot screenshot screenshot
screenshot screenshot screenshot screenshot
screenshot screenshot screenshot screenshot
screenshot screenshot screenshot screenshot
screenshot screenshot screenshot screenshot

Quick start

Install the package from PyPI:

pip install docling-parse

Sequential parsing

docling-parse v7 split page parsing into two public configs:

  • DecodeConfig: how to compute pages. This is fixed when a document is opened.
  • ContentConfig: what to keep or materialize per page. This can be overridden per page.
from docling_core.types.doc.page import TextCellUnit
from docling_parse.pdf_parser import (
    ContentConfig,
    ContentLevel,
    DecodeConfig,
    DoclingPdfParser,
)

parser = DoclingPdfParser(loglevel="fatal")

pdf_doc = parser.load(
    path_or_stream="<path-to-pdf>",
    decode_config=DecodeConfig(
        do_sanitization=True,
        keep_glyphs=False,
    ),
    content_config=ContentConfig(
        char_cells_content_level=ContentLevel.SKIP,
        word_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
        line_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
        shapes_content_level=ContentLevel.SKIP,
        bitmaps_content_level=ContentLevel.SKIP,
    ),
)

for page_no, page in pdf_doc.iterate_pages():
    print(page_no, len(page.word_cells), len(page.textline_cells))

    for word in page.iterate_cells(unit_type=TextCellUnit.WORD):
        print(word.rect, word.text)

    image = page.render_as_image(cell_unit=TextCellUnit.WORD)
    image.show()

Duplicate removal is enabled by default. It removes exact overprints across the page and nearby same-line copies before building words and lines. The distance tolerance scales with glyph width so adjacent repeated letters in very small text survive. Set DecodeConfig(do_remove_duplicate_cells=False) to preserve repeated drawing passes at every cell level.

After construction, repeated words and lines at nearly the same position are also removed. Full text and font must match, clipping must be compatible, and the corresponding rotated corners must be closer than 0.5 pt and 10% of the smaller box dimension. A partial text match or overlapping boxes alone do not qualify. These passes can remove shifted copies separated by other lines that the character pass leaves in place.

This option is independent of do_sanitization. It changes extracted cells; the PDF's rendering instructions are preserved. The native CLI option to preserve copies is --do-remove-duplicate-cells=false.

If you open cheaply and later need richer output, request it per page. When the new content_config needs entities that were previously skipped, that page is re-decoded automatically:

from docling_parse.pdf_parser import ContentConfig, ContentLevel

page = pdf_doc.get_page(
    1,
    content_config=ContentConfig(
        word_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
        line_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
    ),
)

Clipped text

Some producers fit long text into a table cell by clipping it to the cell's box (q <cell> re W n ... Q): the page shows the part that fits, the text layer keeps the whole string. Every char, word and line cell carries the bounding box of the clip it was painted under as clip_bbox (None when nothing clipped it), so a consumer can tell which cell a hidden tail belongs to. Two glyphs under different clips, of which one is cut by its clip, never join into one word or line. Clip paths are tracked even when shapes are skipped; DecodeConfig(keep_clips=False) turns that off.

v6 -> v7 migration

The main API break in v7 is that the old public DecodePageConfig selection flags were split into two concerns:

  • DecodeConfig: compute-time tuning only
  • ContentConfig: what to skip, compute, or materialize per page

In practice:

  • open-time decode_config replaces the old per-page decode tuning
  • per-page content selection now lives in content_config
  • materialize_bitmap_bytes became include_bitmap_bytes
  • threaded page_materialization_config became page_content_config

Typical migration examples:

  • old DecodePageConfig.keep_char_cells=True -> ContentConfig(char_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE)
  • old DecodePageConfig.create_word_cells=True without surfacing them everywhere -> ContentConfig(word_cells_content_level=ContentLevel.COMPUTE)
  • old materialize_bitmap_bytes=False -> ContentConfig(include_bitmap_bytes=False)

One semantic change matters: decode_config is now fixed when the document or threaded batch is opened. If you want richer page output later, override content_config on get_page(...) instead. On the sequential path this may re-decode that page; on the threaded path you can only materialize entities the batch already computed.

Parallel parsing (multi-threaded)

Parse one or more PDFs in parallel with backpressure:

from docling_parse.pdf_parser import (
    ContentConfig,
    ContentLevel,
    DecodeConfig,
    DoclingThreadedPdfParser,
    ThreadedPdfParserConfig,
)

parser = DoclingThreadedPdfParser(
    parser_config=ThreadedPdfParserConfig(
        loglevel="fatal",
        threads=4,
        max_concurrent_results=32,
        page_content_config=ContentConfig(
            word_cells_content_level=ContentLevel.COMPUTE,
            line_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
        ),
    ),
    decode_config=DecodeConfig(),
)

doc_key = parser.load("doc_a.pdf", page_numbers=[1, 3, 5])
print(doc_key, parser.page_count(doc_key), parser.scheduled_page_count(doc_key))

for result in parser.iterate_results():
    if not result.success:
        print(result.doc_key, result.page_number, result.error_message)
        continue

    # Batch decode kept word cells in C++, but did not materialize them by default.
    page = result.get_page(
        ContentConfig(
            word_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
            line_cells_content_level=ContentLevel.COMPUTE_AND_MATERIALIZE,
        )
    )
    print(
        result.doc_key,
        result.page_number,
        len(page.word_cells),
        result.timings.total_s,
    )

For threaded parse-and-render workloads, set ThreadedPdfParserConfig.render_config and use result.get_image(), result.get_image(scale=...), or result.get_image(canvas_size=...).

Call parser.cancel(doc_key) before or during iteration to discard that document's pending pages and unread results. The call returns None immediately after removing work from the queue. Workers finish pages they already claimed in the background and discard their results. Iteration ends as soon as the batch has no results left to deliver.

After consuming any remaining results, call unload() or unload_all(). These calls wait for running workers while other Python threads can continue. Use all_scheduled_work_completed() to check whether all results have been consumed or discarded and the workers have already exited. The check leaves batch startup to has_tasks(). Destroying the parser discards queued work and unread results across the batch and joins the workers.

Use the CLI

$ docling-parse -h
usage: docling-parse [-h] -p PDF

Process a PDF file.

options:
  -h, --help         show this help message and exit
  -p PDF, --pdf PDF  Path to the PDF file

PDF reading and editing

Use PdfEditor for PDF inspection, text extraction, editing and output. Its methods take named arguments and one-based page numbers.

from docling_parse import PdfEditor, PdfExtractionMode

with PdfEditor(source="document.pdf") as editor:
    print(editor.page_count(), editor.metadata.get("Title"))
    print(editor.extract_text(page_no=1, extraction_mode=PdfExtractionMode.LAYOUT))
    editor.rotate_page(page_no=1, angle=90)
    editor.write(target="changed.pdf")

For existing pypdf applications, PdfReader and PdfWriter support a subset of pypdf workflows, including zero-based pages sequences. See the editing guide and its pypdf migration section.

System fonts

A PDF may name a font without embedding it. There is then nothing in the file to draw with, and the renderer substitutes a face installed on the host -- which is why the same document renders differently on two machines, and why a container with no fonts in it renders text as .notdef boxes ("tofu").

Install the usual desktop font packages for text, plus a CJK face for Chinese, Japanese and Korean documents:

Debian / Ubuntu fonts-dejavu-core fonts-liberation2 fonts-freefont-ttf fonts-urw-base35 fonts-noto-core fonts-noto-cjk
Fedora / RHEL dejavu-sans-fonts liberation-sans-fonts urw-base35-fonts google-noto-sans-fonts google-noto-sans-cjk-fonts

On Fedora and RHEL take the packages without -vf- in the name. The variable-font builds carry CFF2 outlines, which the pinned Blend2D cannot read; such a file is still drawn, through FreeType and without shaping, but the static build is the better path.

Three environment variables override what gets substituted. Each names a font file (.ttf, .otf, .ttc), and each is tried before the built-in candidate list -- a path that does not exist, or that neither Blend2D nor FreeType can open, is skipped rather than fatal:

Variable Used for
DOCLING_PARSE_FALLBACK_FONT the general fallback, when a font name resolves to nothing
DOCLING_PARSE_CJK_FALLBACK_FONT requests for a CJK family (/Batang, /SimSun, /MS Gothic, ...)
DOCLING_PARSE_ARABIC_FALLBACK_FONT runs of Arabic script

Setting them is also how a render is made reproducible across machines: pin the same file everywhere and the substituted typeface stops being a property of the host. Run with loglevel="info" to see which file was chosen for each font.

Performance Benchmarks

docs/performance_benchmarks.md compares docling-parse against the other widely used PDF packages on parsing and rendering, with the methodology and the commands to reproduce it.

The tooling behind it lives under scripts/benchmarking/:

Publish an existing run with uv run python scripts/tools/update_performance_docs.py --performance-run-dir RUN (preview), then add --apply after review. Results are organized by dataset and CPU/setup; publication enforces documentation and image size budgets before writing files.

For historical V1 vs V2 benchmarks, see legacy_performance_benchmarks.md.

Development

CXX

To build the parser, simply run the following command in the root folder,

rm -rf build; cmake -B ./build; cd build; make

You can run the parser from your build folder:

% ./parse.exe -h
program to process PDF files or configuration files
Usage:
  PDFProcessor [OPTION...]

  -i, --input arg          Input PDF file
  -c, --config arg         Config file
      --create-config arg  Create config file
  -p, --page arg           Pages to process (default: -1 for all) (default:
                           -1)
      --password arg       Password for accessing encrypted, password-protected files
  -o, --output arg         Output file
  -l, --loglevel arg       loglevel [error;warning;success;info]
  -h, --help               Print usage

If you don't have an input file, a template input file will be printed on the terminal.

Python

To build the package, simply run (make sure uv is installed),

uv sync

The latter will only work after a clean git clone. If you are developing and updating C++ code, please use,

# uv pip install --force-reinstall --no-deps -e .
rm -rf .venv; uv venv; uv pip install --force-reinstall --no-deps -e ".[perf-tools]"

or

BUILD_THREADS=12 uv pip install --force-reinstall --no-deps -e ".[perf]"

To test the package, run:

uv run pytest ./tests -v -s

Contributing

Please read Contributing to Docling Parse for details.

References

If you use Docling in your projects, please consider citing the following:

@techreport{Docling,
  author = {Docling Team},
  month = {8},
  title = {Docling Technical Report},
  url = {https://arxiv.org/abs/2408.09869},
  eprint = {2408.09869},
  doi = {10.48550/arXiv.2408.09869},
  version = {1.0.0},
  year = {2024}
}

License

The Docling Parse codebase is under MIT license. For individual model usage, please refer to the model licenses found in the original packages.

LF AI & Data

Docling (and also docling-parse) is hosted as a project in the LF AI & Data Foundation.

IBM ❤️ Open Source AI

The project was started by the AI for knowledge team at IBM Research Zurich.

7.28.0 Nov 24, 2026
7.27.1 Nov 22, 2026
7.27.0 Nov 19, 2026
7.26.0 Nov 13, 2026
7.25.0 Nov 09, 2026
7.24.2 Oct 29, 2026
7.24.1 Oct 28, 2026
7.24.0 Oct 27, 2026
7.23.1 Oct 26, 2026
7.23.0 Oct 22, 2026
7.22.4 Oct 21, 2026
7.22.3 Oct 13, 2026
7.22.2 Oct 05, 2026
7.22.1 Sep 28, 2026
7.22.0 Sep 26, 2026
7.21.0 Sep 22, 2026
7.20.0 Sep 15, 2026
7.19.1 Sep 11, 2026
7.19.0 Sep 10, 2026
7.18.0 Sep 08, 2026
7.17.0 Sep 02, 2026
7.16.0 Aug 25, 2026
7.15.0 Aug 20, 2026
7.14.0 Aug 18, 2026
7.13.0 Aug 14, 2026
7.12.1 Aug 12, 2026
7.12.0 Aug 11, 2026
7.11.0 Aug 07, 2026
7.10.0 Aug 05, 2026
7.9.0 Aug 04, 2026
7.8.1 Jul 20, 2026
7.8.0 Jul 10, 2026
7.7.1 Jul 10, 2026
7.7.0 Jul 08, 2026
7.6.0 Jul 06, 2026
7.5.0 Jul 03, 2026
7.4.0 Jul 01, 2026
7.3.0 Jul 01, 2026
7.2.0 Jun 29, 2026
7.0.0 Jun 22, 2026
6.2.0 May 28, 2026
6.1.0 May 26, 2026
6.0.0 May 11, 2026
5.11.0 May 08, 2026
5.10.1 Apr 24, 2026
5.10.0 Apr 22, 2026
5.9.0 Apr 15, 2026
5.8.0 Apr 08, 2026
5.7.0 Apr 01, 2026
5.6.2 Mar 29, 2026
5.6.1 Mar 24, 2026
5.6.0 Mar 20, 2026
5.5.0 Mar 04, 2026
5.4.2 Mar 03, 2026
5.4.1 Mar 03, 2026
5.4.0 Feb 24, 2026
5.3.4 Feb 23, 2026
5.3.3 Feb 20, 2026
5.3.2 Feb 17, 2026
5.3.1 Feb 17, 2026
5.3.0 Feb 16, 2026
5.2.0 Jan 30, 2026
5.1.0 Jan 26, 2026
5.0.0 Jan 20, 2026
4.7.3 Jan 14, 2026
4.7.2 Dec 02, 2025
4.7.1 Nov 05, 2025
4.7.0 Oct 20, 2025
4.6.0 Oct 17, 2025
4.5.1 Oct 16, 2025
4.5.0 Sep 17, 2025
4.4.0 Sep 04, 2025
4.3.0 Sep 03, 2025
4.2.3 Aug 22, 2025
4.2.2 Aug 19, 2025
4.2.1 Aug 19, 2025
4.2.0 Aug 19, 2025
4.1.0 Jun 24, 2025
4.0.5 Jun 13, 2025
4.0.4 Jun 10, 2025
4.0.3 Jun 05, 2025
4.0.2 Jun 04, 2025
4.0.1 Apr 09, 2025
4.0.0 Mar 14, 2025
3.4.0 Feb 18, 2025
3.3.1 Feb 13, 2025
3.3.0 Feb 06, 2025
3.2.0 Feb 02, 2025
3.1.2 Jan 27, 2025
3.1.1 Jan 21, 2025
3.1.0 Jan 17, 2025
3.0.0 Dec 09, 2024
2.1.2 Nov 22, 2024
2.1.0 Nov 20, 2024
2.0.5 Nov 20, 2024
2.0.4 Nov 13, 2024
2.0.3 Nov 05, 2024
2.0.2 Oct 30, 2024
2.0.1 Oct 25, 2024
2.0.0 Oct 23, 2024
1.6.2 Oct 18, 2024
1.6.1 Oct 18, 2024
1.6.0 Oct 11, 2024
1.5.1 Oct 10, 2024
1.4.1 Oct 02, 2024
1.3.1 Sep 30, 2024
1.3.0 Sep 20, 2024
1.2.1 Sep 18, 2024
1.2.0 Sep 09, 2024
1.1.3 Aug 30, 2024
1.0.0 Aug 22, 2024

Wheel compatibility matrix

Platform CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython 3.15
macosx_14_0_arm64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
manylinux_2_26_aarch64
manylinux_2_27_x86_64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
win_amd64
win_arm64

Files in release

docling_parse-7.28.0-cp310-cp310-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.9MiB)
docling_parse-7.28.0-cp310-cp310-win_amd64.whl (12.0MiB)
docling_parse-7.28.0-cp310-cp310-win_arm64.whl (9.4MiB)
docling_parse-7.28.0-cp311-cp311-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.1MiB)
docling_parse-7.28.0-cp311-cp311-win_amd64.whl (12.0MiB)
docling_parse-7.28.0-cp311-cp311-win_arm64.whl (9.4MiB)
docling_parse-7.28.0-cp312-cp312-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.1MiB)
docling_parse-7.28.0-cp312-cp312-win_amd64.whl (12.0MiB)
docling_parse-7.28.0-cp312-cp312-win_arm64.whl (9.4MiB)
docling_parse-7.28.0-cp313-cp313-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.1MiB)
docling_parse-7.28.0-cp313-cp313-win_amd64.whl (12.0MiB)
docling_parse-7.28.0-cp313-cp313-win_arm64.whl (9.4MiB)
docling_parse-7.28.0-cp314-cp314-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.1MiB)
docling_parse-7.28.0-cp314-cp314-win_amd64.whl (12.5MiB)
docling_parse-7.28.0-cp314-cp314-win_arm64.whl (9.7MiB)
docling_parse-7.28.0-cp315-cp315-macosx_14_0_arm64.whl (9.8MiB)
docling_parse-7.28.0-cp315-cp315-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (10.6MiB)
docling_parse-7.28.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.1MiB)
docling_parse-7.28.0-cp315-cp315-win_amd64.whl (12.5MiB)
docling_parse-7.28.0-cp315-cp315-win_arm64.whl (9.7MiB)
docling_parse-7.28.0.tar.gz (7.2MiB)
Extras: None
Dependencies:
pillow (<14.0.0,>=10.0.0)
pydantic (>=2.0.0)
docling-core (<3.0.0,>=2.99.0)
pywin32 (>=305)