Component brief / Developer Tools

Docling: local, structure-aware document conversion.

Published
Updated
Last verified
Reading time
4 minutes
Topics
docling / document-processing / rag

What it is

Docling is an open-source document conversion toolkit. It reads PDF, Office and OpenDocument files, HTML, Markdown, images and several specialist formats. It uses a common document model so different inputs have the same representation for headings, tables and captions. Reading order records which element comes next, such as which column to read first. Provenance records where an element came from, for example the page and area containing a table. Docling supported formats · Docling Technical Report

The Python interface centres on DocumentConverter. A conversion pipeline is the sequence of steps it runs. For a scanned PDF, optical character recognition (OCR) reads text from the page image, while table-structure recognition identifies the rows and columns. Docling JSON preserves the document model for other software. A Markdown export is convenient for reading and editing. Docling quickstart · Advanced options

Where it fits

Docling prepares documents for search. Chunking divides a document into passages, for example keeping a password reset heading with the steps beneath it. The search system can create an embedding, a list of numbers representing each chunk, and compare it with an embedding for the user's question.

Docling converts files into structured documents and chunks. These feed embeddings, Qdrant and retrieval, or a Markdown archive and maintained wiki.

Docling's hierarchical chunking uses headings and sections to decide where to split. Its hybrid chunker also counts tokens, pieces of text such as words or word fragments, so a long section can fit the search model's input limit. A separate application can store and search the embeddings, check document permissions and pass matching passages to a model to write an answer. That last pattern is called retrieval-augmented generation (RAG). Docling chunking

When to use it

Choose Docling when:

  • PDFs, scans, tables or mixed office documents are important inputs;
  • local or offline processing is preferable;
  • you need one document representation for several source formats;
  • RAG chunks should retain headings, captions and document provenance; or
  • you want both machine-readable JSON and readable Markdown from one conversion.

For a narrow corpus of clean HTML or Markdown, a simpler parser may be easier to operate.

Trade-offs

Docling gives detailed control over OCR, table extraction, accelerators and enrichment, which also creates configuration and testing work. Model artefacts must be downloaded or prefetched, conversion is heavier than extracting embedded PDF text, and output quality still varies with scans, layouts, languages and table complexity.

Local processing is the default design. Some enrichment options can call remote services, but the pipeline requires explicit enable_remote_services=True opt-in. That is a useful privacy boundary, not a substitute for validating the complete runtime and model supply chain.

Treat conversion quality as corpus-specific. Build a representative evaluation set containing the layouts, tables, scans and languages that matter to the application.

Alternatives

  • DocExtract provides a hosted API for extracting structured data from PDFs and images. It removes local model operation but sends documents to an external service.
  • Cloud document-intelligence services can provide managed OCR, form extraction and support contracts, with vendor-specific APIs and data-processing terms.
  • Format-specific parsers are smaller and faster when inputs are predictable and structural recovery is unnecessary.
  • Vision-language model pipelines can handle difficult visual documents, but cost, latency and non-determinism are usually higher.

Integration example

from docling.document_converter import DocumentConverter

converter = DocumentConverter()
result = converter.convert("architecture.pdf")

markdown = result.document.export_to_markdown()
with open("architecture.md", "w", encoding="utf-8") as output:
    output.write(markdown)

This example is a small experiment with the default converter. In production, restrict accepted formats, set time limits, download the required models before startup and record the Docling version and conversion settings with each export.

AI Disclosure

Researched and drafted with AI assistance, then reviewed by Søren Dalby. Sources are linked; errors may remain, and corrections are welcome.

Sources