Overview
Backends are the foundation of Docling’s document processing architecture. Each backend is responsible for parsing a specific document format and extracting its raw content before pipeline processing stages (OCR, layout analysis, etc.) are applied.Backend Architecture
Docling uses a modular backend system where each document format has a dedicated backend implementation:Backend Types
Docling provides two main categories of backends:Declarative Backends
Declarative backends can transform documents directly toDoclingDocument without requiring a recognition pipeline. These backends handle well-structured formats with explicit content markup.
Examples:
- DOCX (Microsoft Word)
- PPTX (Microsoft PowerPoint)
- XLSX (Microsoft Excel)
- HTML
- Markdown
- AsciiDoc
- Direct conversion to DoclingDocument
- No ML models required
- Fast processing
- Preserves document structure explicitly defined in format
Paginated Backends
Paginated backends extract page-level content and require additional pipeline processing for layout analysis, OCR, and structure recognition. Examples:- Images (JPEG, PNG, TIFF, etc.)
- Extracts raw page content (text, images, metadata)
- Requires pipeline stages for structure recognition
- Supports ML-based enhancements (OCR, layout analysis)
- Page-by-page processing
Available Backends
PDF Backend
Process PDF documents with advanced parsing capabilities
DOCX Backend
Parse Microsoft Word documents with full formatting support
PPTX Backend
Extract content from PowerPoint presentations
XLSX Backend
Process Excel spreadsheets and tables
HTML Backend
Parse HTML documents and web pages
Image Backend
Process images (JPEG, PNG, TIFF, etc.)
Audio Backend
Transcribe audio files using ASR
Backend Interface
All backends implement theAbstractDocumentBackend interface:
Core Methods
Check if the backend successfully loaded and can process the document.
Indicates whether this backend processes documents page-by-page.
Returns the set of input formats this backend can handle.
Free resources and close file handles.
Declarative Backend Methods
Convert the document directly to a
DoclingDocument. Only available on declarative backends.Paginated Backend Methods
Get the total number of pages in the document. Only available on paginated backends.
Load a specific page for processing. Only available on some paginated backends (PDF, Image).
Backend Options
Each backend can be configured with format-specific options:Choosing the Right Backend
Docling automatically selects the appropriate backend based on file extension and MIME type. However, understanding backend characteristics helps optimize performance:For Document Conversion
For Document Conversion
Use DOCX, HTML, or Markdown backends when:
- Source format explicitly defines structure
- No OCR or layout analysis needed
- Fast processing is priority
- Preserving exact formatting is important
For Scanned Documents
For Scanned Documents
Use PDF or Image backends when:
- Documents are scanned or image-based
- OCR is required
- Layout analysis needed for structure detection
- Processing historical or archival documents
For Data Extraction
For Data Extraction
Use XLSX backend when:
- Extracting tabular data from spreadsheets
- Processing financial reports or data exports
- Working with structured data in Excel format
For Presentations
For Presentations
Use PPTX backend when:
- Converting slide decks to structured format
- Extracting presentation content
- Processing training materials or reports
For Web Content
For Web Content
Use HTML backend when:
- Processing web pages or HTML exports
- Converting documentation sites
- Handling markdown-rendered HTML
For Audio/Video
For Audio/Video
Use Audio backend when:
- Transcribing recorded meetings or interviews
- Processing podcast or lecture audio
- Converting speech to text
Backend Lifecycle
Typical backend lifecycle during document processing:Thread Safety
Backend thread-safety considerations:- Initialization: Backends should be created per-thread or protected by locks
- Page Loading (PDF/Image): Page backends are designed for concurrent access
- Resource Management: Call
unload()when done to free resources
Custom Backends
Docling’s backend system is extensible. To implement a custom backend:- Inherit from
AbstractDocumentBackend,DeclarativeDocumentBackend, orPaginatedDocumentBackend - Implement required abstract methods
- Register backend with DocumentConverter
See Also
- PDF Backend - PDF processing details
- DOCX Backend - Word document processing
- Pipeline Options - Configure pipeline stages
- DocumentConverter - Main conversion API