Skip to main content
Azure Document Intelligence (formerly Form Recognizer) provides cloud-based document conversion with advanced OCR, layout analysis, and formula extraction capabilities.

Overview

The Document Intelligence converter uses the prebuilt-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

This installs:
  • azure-ai-documentintelligence
  • azure-identity
2

Create Azure Resource

  1. Sign in to Azure Portal
  2. Create a Document Intelligence resource
  3. Note your Endpoint URL (e.g., https://YOUR_ENDPOINT.cognitiveservices.azure.com/)
  4. 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:
Save to file:
Document Intelligence requires:
  • A file path (stdin is not supported)
  • A valid endpoint URL
  • Valid authentication credentials

Python API

Authentication

Document Intelligence supports multiple authentication methods:

Environment Variable (Default)

Set AZURE_API_KEY:

API Key Credential

Explicitly provide the key:
Use DefaultAzureCredential for automatic credential detection:
This supports:
  • 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:
Available file types:
  • DOCX - Word documents
  • PPTX - PowerPoint presentations
  • XLSX - Excel spreadsheets
  • HTML - HTML files
  • PDF - 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

Document Intelligence is a paid Azure service. Each document conversion consumes API credits.
Cost factors:
  • Pages processed: Charged per page
  • Features used: OCR, formulas, and style analysis may incur additional costs
  • Model type: prebuilt-layout model pricing
See Azure Document Intelligence pricing for details.

Minimize Costs

Converter Priority

When Document Intelligence is enabled, it takes priority over built-in converters for supported file types:
To explicitly control converter priority:

Examples

Scanned PDF with Tables

Batch Processing

With Docker

Troubleshooting

Missing Dependencies

Solution:

Authentication Errors

Check:
  • Endpoint URL is correct
  • AZURE_API_KEY is set or credential is provided
  • API key is valid and not expired

Endpoint Not Found

Solution:

Stdin Not Supported

Document Intelligence requires a file path:

Comparison: Document Intelligence vs Offline

Use Document Intelligence for:
  • Scanned documents
  • Complex layouts with tables
  • Documents with formulas
  • High-quality OCR requirements
Use offline converters for:
  • Cost-sensitive applications
  • Privacy-critical documents
  • Simple, well-structured documents
  • Offline environments