This page documents the docling command-line interface (CLI) for converting documents from various input formats (PDF, DOCX, HTML, images, audio, video, etc.) into structured output formats. The CLI provides a high-level wrapper around the document conversion pipeline system.
For programmatic usage via Python API, see Python SDK. For details on configuring pipelines and models, see Configuration and Pipeline Options. For information about the underlying document conversion engine, see Core Architecture.
Sources: docling/cli/main.py1-166 docling/cli/main.py432-628
The Docling CLI consists of multiple primary command-line entry points. Note that the project supports both a full docling package and a modular docling-slim package which requires the [cli] extra for CLI functionality pyproject.toml69-72
docling - Main document conversion interface (maps to docling.cli.main:app) docling/cli/main.py71docling-tools - Model management utilities and diagnostic tools docling/cli/tools.py72docling convert-remote - CLI command for interacting with a remote Docling service instance docling/cli/main.py64The primary command is docling convert, which orchestrates document conversion through the DocumentConverter class docling/document_converter.py133 and exports results in multiple output formats.
Sources: docling/cli/main.py71 packages/docling/pyproject.toml67-69 docling/document_converter.py133 pyproject.toml69-72
The CLI is built using the typer library docling/cli/main.py19 which maps command-line arguments to Python functions. It acts as a bridge between the user's shell and the DocumentConverter orchestrator docling/document_converter.py133
Title: CLI Component Architecture
Sources: docling/cli/main.py183-188 docling/cli/main.py432-628 docling/document_converter.py132-145 docling/datamodel/pipeline_options.py112-126
The CLI follows a linear flow from argument parsing to file export, utilizing the convert_all method for batch processing.
Title: CLI Execution Pipeline
Sources: docling/cli/main.py432-842 docling/document_converter.py133
The docling convert command is the main tool for transforming documents. It supports a wide range of parameters to control the conversion pipeline, including OCR engine selection, table extraction modes, and Vision Language Model (VLM) integration.
Key capabilities include:
--from to restrict input formats (e.g., pdf, docx, xlsx, odf) docling/cli/main.py441STANDARD, VLM, or ASR pipelines via --pipeline docling/cli/main.py470--ocr/--no-ocr and select engines like rapidocr, tesseract, easyocr, or mac docling/cli/main.py494-513--enrich-code, --enrich-formula, or --enrich-picture-description docling/cli/main.py545-573InputFormat.AUDIO and InputFormat.VIDEO (e.g., mp3, mp4, wav) to trigger the AsrPipeline or VideoPipeline docling/datamodel/base_models.py108 CHANGELOG.md7smoldocling or granite_docling for VLM-based extraction docling/cli/main.py125-126For a complete list of parameters and usage examples, see Document Conversion CLI.
Sources: docling/cli/main.py432-628 docling/datamodel/pipeline_options.py164-200 docling/datamodel/base_models.py108
Docling relies on several AI models for layout analysis, OCR, and table structure recognition. The CLI and its tools provide commands for managing these model artifacts.
Title: Model Management CLI Structure
The docling-tools models command provides functionality to download and manage model artifacts.
docling-tools models download: This command downloads a predefined set of models or specific models chosen by the user. It supports layout models, table structure models (docling_tableformer), and OCR engines.docling-tools models download-hf-repo: This command allows downloading specific models directly from HuggingFace by their repository ID.Key features include:
VlmConvertOptions registry docling/cli/main.py125PdfBackend.DOCLING_PARSE or PdfBackend.PYPDFIUM2 docling/datamodel/pipeline_options.py117For details on downloading and managing model files, see Model Management CLI.
Sources: docling/cli/main.py125 docling/datamodel/pipeline_options.py117 docling/datamodel/settings.py130
The CLI supports exporting the internal DoclingDocument representation into several common formats. This is handled by the export_documents helper function docling/cli/main.py233
| Output Format | CLI Option | Implementation Method |
|---|---|---|
| Markdown | --to md | doc.save_as_markdown() docling/cli/main.py326 |
| JSON | --to json | doc.save_as_json() docling/cli/main.py263 |
| HTML | --to html | doc.save_as_html() docling/cli/main.py279 |
| Text | --to text | doc.save_as_markdown(strict_text=True) docling/cli/main.py316 |
| DocTags | --to doctags | doc.save_as_doctags() docling/cli/main.py334 |
| DocLang | --to doclang | doc.save_as_doclang() docling/cli/main.py331 |
| DCLX | --to dclx | Export as DocLang Archive docling/cli/main.py337 |
Sources: docling/cli/main.py233-337 docling/datamodel/base_models.py109
The CLI provides built-in flags for version tracking and environment inspection:
--version: Displays versions for docling and its core components docling/cli/main.py197-213--show-external-plugins: Lists all discovered OCR, layout, and table structure plugins using factories docling/cli/main.py215-230--print-timings: Outputs detailed profiling information for each pipeline stage docling/cli/main.py608Sources: docling/cli/main.py197-230 docling/cli/main.py608-610