Overview
The Document Intelligence converter uses theprebuilt-layout model to extract Markdown directly from documents with:
- High-resolution OCR
- Table detection and extraction
- Formula recognition (LaTeX output)
- Font style preservation
- Multi-column layout handling
Document Intelligence is particularly useful for scanned documents, images, and complex PDFs where offline conversion may struggle.
Prerequisites
1
Install Optional Dependencies
azure-ai-documentintelligenceazure-identity
2
Create Azure Resource
- Sign in to Azure Portal
- Create a Document Intelligence resource
- Note your Endpoint URL (e.g.,
https://YOUR_ENDPOINT.cognitiveservices.azure.com/) - Get your API Key from the “Keys and Endpoint” section
3
Configure Authentication
Set your API key as an environment variable:Or use Azure credential mechanisms (see Authentication below)
Usage
Command Line
Use the-d / --use-docintel flag with -e / --endpoint:
Python API
Authentication
Document Intelligence supports multiple authentication methods:Environment Variable (Default)
SetAZURE_API_KEY:
API Key Credential
Explicitly provide the key:Azure Identity (Recommended for Production)
Use DefaultAzureCredential for automatic credential detection:- Environment variables (
AZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET) - Managed Identity (when running in Azure)
- Azure CLI authentication
- Visual Studio Code authentication
Service Principal
Configuration Options
API Version
Specify the Document Intelligence API version:File Types
Control which file types use Document Intelligence:DOCX- Word documentsPPTX- PowerPoint presentationsXLSX- Excel spreadsheetsHTML- HTML filesPDF- PDF documents (with OCR)JPEG- JPEG images (with OCR)PNG- PNG images (with OCR)BMP- BMP images (with OCR)TIFF- TIFF images (with OCR)
By default, Document Intelligence is used for: DOCX, PPTX, XLSX, PDF, JPEG, PNG, BMP, and TIFF files.
Supported Features
OCR File Types
Document Intelligence provides high-resolution OCR for:Analysis Features
For OCR-supported file types, Document Intelligence enables:- High-Resolution OCR: Enhanced text extraction from images
- Formula Extraction: Mathematical formulas converted to LaTeX
- Font Style Detection: Preserves bold, italic, and other styles
Non-OCR File Types
For DOCX, PPTX, XLSX, and HTML files, Document Intelligence performs layout analysis without OCR features.Error Handling
Cost Considerations
Cost factors:- Pages processed: Charged per page
- Features used: OCR, formulas, and style analysis may incur additional costs
- Model type:
prebuilt-layoutmodel pricing
Minimize Costs
Converter Priority
When Document Intelligence is enabled, it takes priority over built-in converters for supported file types:Examples
Scanned PDF with Tables
Batch Processing
With Docker
Troubleshooting
Missing Dependencies
Authentication Errors
- Endpoint URL is correct
AZURE_API_KEYis set or credential is provided- API key is valid and not expired