Docling OCRIndependent Docling guide
Developer Documentation

Docling Python Quickstart & CLI Tutorial

Step-by-step developer tutorial for installing IBM's Docling, running local batch conversions, enabling CUDA GPU acceleration, and exporting to clean Markdown.

Don't Want to Write Code?

Use the Online Web GUI — No Terminal Needed

Convert any document in your browser with zero terminal installation.

Open Web GUI ↗

1. System Requirements & Installation

Docling requires Python 3.10 or higher. We recommend creating a clean virtual environment:

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install basic package
pip install docling

# Or install with full OCR engine support
pip install "docling[ocr]"

2. Command Line Interface (CLI) Usage

Once installed, you can convert local files or remote URLs directly from your terminal:

# Convert a local PDF
docling sample_paper.pdf

# Convert an online arXiv paper directly
docling https://arxiv.org/pdf/2408.09869

# Export directly to custom output directory
docling sample.pdf --output ./dist --to md

3. Python Script Example

Here is how to integrate DocumentConverter in your Python backend:

from pathlib import Path
from docling.document_converter import DocumentConverter

# Initialize converter
converter = DocumentConverter()

# Convert PDF or image
source = Path("financial_statement.pdf")
conversion_result = converter.convert(source)

# Export to clean Markdown
markdown_output = conversion_result.document.export_to_markdown()

# Save output
with open("output.md", "w", encoding="utf-8") as f:
    f.write(markdown_output)

print("Conversion complete!")

4. Common Issues & Pitfalls

Issue: Out of Memory (OOM) on Large PDFs

Processing 50+ page PDFs locally can consume 8GB+ of RAM. If running in a memory-constrained container, consider processing in page chunks or deploying the official docling-serve container with worker limits.

Issue: Missing OpenCV System Dependencies

On Debian/Ubuntu, you may encounter ImportError: libGL.so.1: cannot open shared object file. Fix with: sudo apt-get install ffmpeg libsm6 libxext6.

For repeated runs, keep the input and output paths explicit and save the pipeline settings alongside the result.

Related Docling guides

Browse all Docling guides →