GenAIHub
← Back to Technical Section

Docling

IBM's Open-Source Document Parsing Library for GenAI

What is Docling?

Docling is an open-source document parsing and conversion library developed by IBM. It transforms complex documents (PDFs, DOCX, PPTX, images) into machine-readable formats like JSON and Markdown, making unstructured data ready for Retrieval-Augmented Generation (RAG), question-answering systems, and other GenAI applications.

"Docling enables AI-powered document understanding with advanced layout analysis, table extraction, and seamless integration with LangChain and LlamaIndex."

Multi-Format

PDF, DOCX, PPTX, HTML

AI-Powered

DocLayNet & TableFormer

Local Execution

Runs on laptop

MIT License

Open Source

Core Features

Multi-Format Document Parsing

Docling processes a wide variety of document formats and converts them into structured, machine-readable JSON and Markdown. Supported formats include PDFs (native and scanned), Word documents, PowerPoint presentations, images, and HTML.

PDF DOCX PPTX Images HTML Markdown

AI-Powered Layout Analysis (DocLayNet)

Uses IBM's DocLayNet model for sophisticated page layout analysis. This computer vision approach identifies document structure, reading order, headers, paragraphs, and other elements—often bypassing traditional OCR for improved speed and accuracy.

Reading Order Structure Detection Multi-Column

Table Recognition (TableFormer)

TableFormer provides high-accuracy extraction and structuring of tables from documents. It preserves cell relationships, headers, and data integrity—critical for enterprise documents with complex tabular data.

Cell Recognition Header Detection Spanning Cells

Unified Docling Document Format

All processed documents are transformed into a consistent "Docling Document" structure. This uniform representation includes text, tables, images, document hierarchy, and layout metadata—making downstream processing predictable and reliable.

JSON Output Markdown Export Hierarchy Preserved

Granite-Docling Model

Ultra-Compact Vision-Language Model (VLM)

Granite-Docling is a 258M parameter open-source VLM designed to enhance the Docling pipeline. It enables end-to-end document understanding in a single pass, handling:

  • Inline and floating math equations
  • Code blocks and technical content
  • Multilingual support (Arabic, Chinese, Japanese)
  • Complex document layouts

Quick Start

# Install Docling
pip install docling

# Basic usage - convert PDF to Markdown
from docling.document_converter import DocumentConverter

# Initialize converter
converter = DocumentConverter()

# Convert a document
result = converter.convert("path/to/document.pdf")

# Export to Markdown
markdown = result.document.export_to_markdown()
print(markdown)

# Export to JSON
json_output = result.document.export_to_json()
print(json_output)

Tip: Docling runs locally on standard hardware. No cloud API required—ensuring data privacy for sensitive enterprise documents.

Integration with LLM Frameworks

Docling is designed for seamless integration with popular LLM frameworks, making it ideal for building RAG pipelines and document Q&A systems.

LangChain Integration

from langchain_community.document_loaders import DoclingLoader

loader = DoclingLoader(file_path="report.pdf")
docs = loader.load()

# Use with your RAG pipeline
for doc in docs:
    print(doc.page_content[:200])

LlamaIndex Integration

from llama_index.readers.docling import DoclingReader

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

# Index and query
index = VectorStoreIndex.from_documents(documents)

Use Cases

RAG Pipelines

Prepare documents for retrieval-augmented generation

Document Q&A

Extract answers from enterprise documents

Data Extraction

Extract tables and structured data from PDFs

Contract Analysis

Parse legal documents for clause extraction

Knowledge Base

Build searchable archives from document libraries

Report Processing

Automate analysis of financial reports

Resources & References

Related Topics