Home / Docs / Technical Manual

Docling Complete Technical Documentation

TL;DR / Quick Summary
  • Docling parses PDF, DOCX, PPTX, XLSX, HTML, EPUB, CSV, scanned images, and audio into structured Markdown, HTML, and JSON.
  • Includes state-of-the-art layout analysis, reading order recovery, and TableFormer v2 table structure extraction models.
  • Supports multiple pluggable OCR engines: EasyOCR, Tesseract (tesserocr), RapidOCR, OcrMac, and Nemotron OCR.
  • Features self-hosted REST API serving (docling-serve v1.21.0) and Model Context Protocol (docling-mcp) for AI desktop clients like Claude and LM Studio.
  • Released under the 100% free and open-source MIT License by IBM Research / LF AI & Data Foundation.

1. Overview & Architecture

Docling is an open-source document conversion and layout analysis engine designed to power Retrieval-Augmented Generation (RAG) and LLM applications. Unlike naive plain-text extractors, Docling processes input documents through modular conversion pipelines that analyze page geometry, detect bounding boxes, parse headers and lists, reconstruct multi-column reading order, and infer complex tabular structures using neural vision models.

Key Architectural Highlights
Docling operates entirely in-process or via lightweight local containers. It does not require remote third-party API calls unless specifically configured to stream from external vision models.

2. Installation & Environment Setup

Docling can be installed using standard Python package managers such as pip or uv. It supports Python 3.9 through Python 3.14 on Windows, macOS, and Linux architectures.

bash — standard installation
$pip install docling

Package Extras

Some heavy neural features are provided as optional extras to minimize core installation weight:

Extra Name Description Install Command
asr Audio transcription via OpenAI Whisper models. pip install "docling[asr]"
vlm Vision Language Model pipelines (SmolDocling, Granite Vision). pip install "docling[vlm]"
easyocr EasyOCR engine for bitmap text recognition. pip install "docling[easyocr]"
tesserocr Direct C-bindings to Tesseract OCR engine. pip install "docling[tesserocr]"
rapidocr RapidOCR engine with ONNX Runtime backend. pip install "docling[rapidocr]"

3. Basic Quickstart Usage

Converting a document into structured Markdown requires only three lines of Python code using the primary DocumentConverter class.

python — basic conversion
from docling.document_converter import DocumentConverter

source = "https://arxiv.org/pdf/2408.09869" # Local path or URL
converter = DocumentConverter()
result = converter.convert(source)

# Export to Markdown
markdown_output = result.document.export_to_markdown()
print(markdown_output[:500])
              

4. The DoclingDocument Representation Model

The core output data model in Docling is the DoclingDocument schema. It maintains an object-oriented document tree containing structured elements such as sections, paragraphs, tables, code blocks, list items, and pictures with exact spatial coordinates (bounding boxes).

Lossless Export Options
Calling result.document.export_to_dict() or export_to_json() provides the complete node hierarchy, cell matrices, and font attributes for advanced NLP parsing.

5. Processing Pipelines

Docling routes different file extensions to specialized processing pipelines:

  • StandardPdfPipeline: Default engine for PDF and raster image layout analysis, TableFormer extraction, and OCR.
  • VlmPipeline (Granite Docling): End-to-end vision-language model pipeline utilizing Granite Docling or SmolDocling presets for visual document parsing.
  • AsrPipeline: Automatic Speech Recognition pipeline transcribing MP3, WAV, and audio tracks via Whisper.
  • SimplePipeline: Lightweight parser for DOCX, PPTX, XLSX, HTML, and EPUB files.

Granite Docling VLM Model Setup

Granite Docling is IBM's official vision-language model preset built specifically for high-accuracy document page understanding. To convert documents using Granite Docling in Python:

python — granite docling vlm setup
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import VlmPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

vlm_options = VlmPipelineOptions()
vlm_options.vlm_model = "granite_docling"  # Granite Docling VLM preset

converter = DocumentConverter(
    format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=vlm_options)}
)
result = converter.convert("complex_layout.pdf")
print(result.document.export_to_markdown())
              

6. OCR Engines & Configuration

Architecture Note: Is Docling an OCR engine? Docling is not a standalone raw OCR engine like Tesseract, PaddleOCR, or EasyOCR. Instead, Docling is a high-level document understanding and orchestration framework that wraps and powers OCR engines under the hood. While raw OCR engines only extract text strings from cropped image pixels, Docling adds neural layout detection, multi-column reading order recovery, TableFormer matrix extraction, and exports structured Markdown and JSON for LLM RAG pipelines.

Docling supports pluggable OCR engine backends via PdfPipelineOptions. You can select your preferred OCR engine explicitly using pipeline_options.ocr_options:

python — tesseract ocr setup
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions, TesseractOcrOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

pipeline_options = PdfPipelineOptions()
pipeline_options.do_ocr = True
pipeline_options.ocr_options = TesseractOcrOptions()

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

7. RAG & Native Document Chunking (`HybridChunker`)

A major advantage of Docling over naive Markdown text splitters is its native chunking framework. Instead of splitting text blindly on token counts, Docling's HybridChunker operates directly on DoclingDocument nodes. Unlike naive text splitters, Docling HybridChunker natively preserves header context, table matrix structure, page numbers, and bounding box coordinates for precise RAG embedding and vector search.

python — native hybridchunker for RAG
from docling.document_converter import DocumentConverter
from docling.chunking import HybridChunker

# 1. Convert document
converter = DocumentConverter()
result = converter.convert("research_paper.pdf")

# 2. Initialize native HybridChunker
chunker = HybridChunker(max_tokens=512, merge_peers=True)
chunk_iter = chunker.chunk(result.document)

# 3. Iterate over structured chunks with metadata
for chunk in chunk_iter:
    print(f"Heading Path: {chunk.meta.headings}")
    print(f"Text Content: {chunk.text[:100]}...\n")
              
RAG Vector Store Integration
Native Docling chunks integrate directly into vector databases like Qdrant, Milvus, Chroma, and Pinecone while carrying full page number and bounding box metadata.

8. GPU Acceleration & High-Throughput Batch Tuning

Docling pipelines utilize PyTorch for neural layout analysis and OCR. To achieve maximum conversion throughput on large PDF datasets, configure AcceleratorOptions for NVIDIA CUDA or Apple Silicon MPS:

python — gpu cuda batch tuning
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.pipeline_options import ThreadedPdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption

# 1. Enable CUDA / MPS GPU acceleration
accelerator_options = AcceleratorOptions(device=AcceleratorDevice.CUDA)

# 2. Increase batch size and thread concurrency for high throughput
pipeline_options = ThreadedPdfPipelineOptions(
    accelerator_options=accelerator_options,
    page_batch_size=8,      # Batch GPU inference across pages
    layout_batch_size=64,   # Layout detection batch size
    ocr_batch_size=64,      # OCR batch size
)

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

9. Framework Integrations (LangChain, LlamaIndex & Haystack)

Docling features native integrations with major Generative AI frameworks:

LangChain (`langchain-docling`)

python — langchain docling loader
from langchain_docling import DoclingLoader

loader = DoclingLoader(file_path="annual_report.pdf")
docs = loader.load()
print(f"Loaded {len(docs)} structured documents for LangChain RAG pipeline.")
              

LlamaIndex (`llama-index-readers-docling`)

python — llamaindex docling reader
from llama_index.readers.docling import DoclingReader

reader = DoclingReader()
documents = reader.load_data(file_path="financial_statement.pdf")
              

10. VLM Vision Model Catalog

Docling supports 15+ Vision-Language Model (VLM) presets for end-to-end visual page parsing:

Preset Name Model Provider Primary Use Case CLI Argument
granite_docling IBM Research Default high-accuracy visual PDF layout & table parser --vlm-model granite_docling
smoldocling Hugging Face / IBM Ultra-lightweight fast VLM for CPU and edge devices --vlm-model smoldocling
deepseek_ocr DeepSeek High-density multilingual document OCR --vlm-model deepseek_ocr
pixtral Mistral AI Complex multimodal chart & diagram understanding --vlm-model pixtral
granite_vision IBM Granite Enterprise document understanding and reasoning --vlm-model granite_vision

7. FastAPI Serve API (`docling-serve`)

To deploy Docling as an enterprise HTTP REST API service, run docling-serve (v1.21.0). It exposes async conversion endpoints and interactive OpenAPI Swagger docs at /docs.

bash — run docling-serve
$docker run -p 5001:5001 ghcr.io/docling-project/docling-serve:latest

8. Model Context Protocol (MCP) Integration

The docling-mcp server connects Docling directly into AI agent environments like Claude Desktop and LM Studio, allowing LLM agents to convert PDF files on-demand during chat sessions.

json — claude_desktop_config.json
{
  "mcpServers": {
    "docling": {
      "command": "uvx",
      "args": [
        "--from=docling-mcp",
        "docling-mcp-server"
      ]
    }
  }
}
              

9. Complete CLI Parameter Reference

Summary of all available flags for the docling command-line tool:

Option / Flag Value Type Default Description
--to md, json, html, doctags md Output document export format.
--ocr / --no-ocr Boolean Flag true Enable or disable optical character recognition.
--ocr-mode default, full_page default OCR region targeting strategy.
--ocr-engine auto, easyocr, tesserocr... auto Select specific OCR engine provider.
--table-mode accurate, fast accurate TableFormer structure model accuracy mode.
--device auto, cpu, cuda, mps auto Hardware acceleration device target.
--num-threads Integer 4 Number of CPU execution threads.