DocumentConverter Configuration#
DocumentConverter is Docling's main entry point for document conversion. Format-specific behavior is controlled by a format_options dictionary passed at construction, mapping each InputFormat enum value to a FormatOption instance. Formats not present in the dictionary receive default options automatically.
converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=PdfPipelineOptions(...)),
InputFormat.XLSX: ExcelFormatOption(backend_options=MsExcelBackendOptions(...)),
}
)
Each FormatOption bundles three things :
| Field | Type | Purpose |
|---|---|---|
pipeline_cls | Type[BasePipeline] | Which pipeline runs the conversion |
pipeline_options | PipelineOptions | None | Controls ML models, OCR, enrichment |
backend_options | BackendOptions | None | Controls backend-specific parsing |
If pipeline_options is not set, it is populated from pipeline_cls.get_default_options() at construction time. Pipelines are cached by a composite key of (pipeline_class, md5(pipeline_options)), so multiple formats sharing the same class and options reuse a single initialized pipeline .
Class Hierarchy#
FormatOption classes (docling/document_converter.py)#
Each supported format has a named FormatOption subclass pre-wired with the correct pipeline_cls and backend :
| Class | Pipeline | Backend | Formats |
|---|---|---|---|
PdfFormatOption | StandardPdfPipeline | DoclingParseDocumentBackend | |
ImageFormatOption | StandardPdfPipeline | ImageDocumentBackend | Images |
WordFormatOption | SimplePipeline | MsWordDocumentBackend | DOCX |
PowerpointFormatOption | SimplePipeline | MsPowerpointDocumentBackend | PPTX |
ExcelFormatOption | SimplePipeline | MsExcelDocumentBackend | XLSX |
HTMLFormatOption | SimplePipeline | HTMLDocumentBackend | HTML |
MarkdownFormatOption | SimplePipeline | MarkdownDocumentBackend | MD |
AudioFormatOption | AsrPipeline | NoOpBackend | Audio |
LatexFormatOption | SimplePipeline | LatexDocumentBackend | LaTeX |
EpubFormatOption | SimplePipeline | EpubDocumentBackend | EPUB |
The base BaseFormatOption (in docling/datamodel/base_models.py) holds the pipeline_options and backend fields; FormatOption adds backend_options and the pipeline_cls field .
pipeline_options — docling/datamodel/pipeline_options.py#
The pipeline_options field accepts any PipelineOptions subclass. The hierarchy is:
PipelineOptions ← timeout, accelerator, artifacts_path
└── ConvertPipelineOptions ← picture classification/description, chart extraction
└── PaginatedPipelineOptions ← images_scale, generate_page_images
├── PdfPipelineOptions ← OCR, table structure, layout, formula enrichment
└── VlmPipelineOptions ← VLM-based holistic page understanding
AsrPipelineOptions ← speech recognition (audio)
Key PipelineOptions fields : document_timeout, accelerator_options, enable_remote_services, artifacts_path.
Key ConvertPipelineOptions additions : do_picture_classification, do_picture_description, picture_description_options, do_chart_extraction, chart_extraction_options.
Key PdfPipelineOptions additions : do_ocr, force_ocr, ocr_engine, do_table_structure, table_structure_options, do_code_enrichment, do_formula_enrichment, pdf_backend.
Runtime override constraint: Only do_* flags can be changed at conversion time (and only from True → False). All other options must be identical to those used at pipeline initialization. Attempting to enable a do_* flag or change non-flag fields raises an error .
backend_options — docling/datamodel/backend_options.py#
The backend_options field is typed as BackendOptions, a discriminated union keyed on kind. Not all FormatOption subclasses expose backend_options; only those with format-specific parsing configuration do:
| Backend Options Class | kind | Key Fields |
|---|---|---|
PdfBackendOptions | "pdf" | password, enforce_same_font |
ThreadedDoclingParseBackendOptions | "threaded-docling-parse" | parser_threads, release_native_memory_every_n_pages |
MsExcelBackendOptions | "xlsx" | treat_singleton_as_text, parse_charts, gap_tolerance, sheet_names |
HTMLBackendOptions | "html" | render_page, fetch_images, source_uri, headers |
EpubBackendOptions | "epub" | fetch_images, max_total_bytes, max_file_bytes |
MarkdownBackendOptions | "md" | fetch_images, source_uri |
LatexBackendOptions | "latex" | parse_timeout, tikz_engine |
XBRLBackendOptions | "xbrl" | taxonomy |
Examples#
PDF with custom OCR and table extraction:
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.base_models import InputFormat
pipeline_options = PdfPipelineOptions()
pipeline_options.do_ocr = False
pipeline_options.do_table_structure = True
converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
}
)
XLSX with sheet filtering:
from docling.datamodel.backend_options import MsExcelBackendOptions
from docling.document_converter import DocumentConverter, ExcelFormatOption
from docling.datamodel.base_models import InputFormat
converter = DocumentConverter(
format_options={
InputFormat.XLSX: ExcelFormatOption(
backend_options=MsExcelBackendOptions(sheet_names=["Summary", "Q4"])
)
}
)
HTML with headless browser rendering:
from docling.datamodel.backend_options import HTMLBackendOptions
from docling.document_converter import DocumentConverter, HTMLFormatOption
from docling.datamodel.base_models import InputFormat
converter = DocumentConverter(
format_options={
InputFormat.HTML: HTMLFormatOption(
backend_options=HTMLBackendOptions(render_page=True, fetch_images=True)
)
}
)
Key Source Files#
| File | Purpose |
|---|---|
docling/document_converter.py | DocumentConverter, all FormatOption subclasses, _get_default_option |
docling/datamodel/base_models.py | BaseFormatOption, InputFormat |
docling/datamodel/pipeline_options.py | Full PipelineOptions hierarchy |
docling/datamodel/backend_options.py | All BackendOptions subclasses, discriminated union |