Document Extraction
OCR · layout · schema-based field extraction · analyzers · confidence and grounding · RAG-ready Markdown · agentic mode
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
From OCR to schema-based extraction
Basic OCR recognizes printed text and focuses on text extraction. It doesn't understand meaning, context or relationships between words. Content Understanding goes beyond OCR-based text extraction with schema-based extraction of fields and their values.
- A schema lists the fields you want and how they are structured. Schemas support structured and nested fields (for example an
Itemscollection with description, unit price, quantity and line total). - Schemas are applied semantically: fields can be extracted even if labels differ or are missing.
- An analyzer takes input, applies AI analysis and produces structured results. It reuses the same extraction logic for every request.
- Workflow: ingest content, AI-powered analysis (OCR, speech recognition, natural language understanding and multimodal models), then structured output such as JSON.
- Content extraction: OCR text (printed and handwritten), selection marks, barcodes, formulas in LaTeX, paragraphs, tables (including spanning cells and multipage layouts) and hierarchical sections.
| Analyzer | Use it for |
|---|---|
prebuilt-read | Basic OCR: words, paragraphs, formulas, barcodes. No layout analysis. |
prebuilt-layout | Words, figures, paragraphs, tables, sections, hyperlinks, annotations in digital PDFs. Doesn't need a language or embedding model. |
prebuilt-digitalParse | Machine-readable content from the file's internal structure. For scanned or image-based documents use prebuilt-read or prebuilt-layout. |
prebuilt-documentSearch | RAG ingestion: Markdown, figure descriptions, summary, chunked output. |
prebuilt-invoice, prebuilt-receipt, prebuilt-idDocument | Domain-specific field extraction. |
Field extraction, confidence and grounding
| Method | Meaning |
|---|---|
extract | Values as they appear in the content (documents only). |
classify | Pick from predefined categories. |
generate | Free generation or inference, such as a summary or a risk level. |
- Confidence score: a reliability estimate from 0 to 1 for each extracted field value.
- Grounding: the specific regions in the content where each value was extracted or generated.
- Both are opt-in for all document field methods: set
estimateFieldSourceAndConfidence = truein the analyzer config, orestimateSourceAndConfidence = trueon one field. - Route low-confidence or insufficiently grounded results to human review; let high-confidence, grounded results continue downstream.
- Typed values such as dates and numbers are normalized to a canonical format. Normalization isn't configurable.
- The
sourcestring locates an element:D(page,left,top,width,height)for an axis-aligned box orD(page,x1,y1,x2,y2,x3,y3,x4,y4)for a bounding polygon. Page numbers are one indexed.
| Config property | Default | Effect |
|---|---|---|
enableOcr | true | OCR for scans and image-based PDFs. Can be disabled for native digital PDFs to improve performance. |
enableLayout | true | Paragraphs, lines, words, reading order, structure. |
enableFormula | true | Formulas in LaTeX. |
enableBarcode | true | Barcodes and QR codes. |
tableFormat | html | Table output: html or markdown. |
enableFigureDescription | false | Text descriptions for figures, diagrams and images. |
enableFigureAnalysis | false | Chart data extraction and diagram components. |
returnDetails | false (varies by analyzer) | More metadata: confidence scores, bounding boxes, text spans. |
extractionMode chooses how document content is analyzed: layout-aware extraction for structured documents where tables, sections and reading order matter, or faster text-only extraction to produce clean Markdown for RAG and ingestion.
Clean representations for agents and RAG
- Content Understanding delivers clean Markdown for reasoning and knowledge workflows, and schema-aligned key-value fields (with confidence and grounding) when structured data is needed. Output is Markdown for search and retrieval, or JSON that matches your schema.
prebuilt-documentSearchis recommended for document ingestion in RAG: figure descriptions, charts as chart.js and diagrams as mermaid.js (PDF and image formats), a one-paragraph summary and chunked output ready for embedding and vector indexing.- To improve retrieval in Azure AI Search, enrich documents before indexing; Content Understanding preserves sections, tables (including cross-page), figures and descriptions. See the Azure AI Search Content Understanding skill.
- Guardrails on the model deployment can suppress generated field values. Extracted content (Markdown, pages, paragraphs) can remain, and analysis can return Succeeded with warnings. Succeeded doesn't guarantee every requested field has a value; review warnings before automating.
Agentic mode (preview)
- Use it when an answer must be built from evidence across a document: multistep reasoning, calculations, validation, visual analysis. For straightforward extraction use a standard document analyzer.
- Set
config.workflowto"agentic"with API version2026-06-01-preview. It costs more tokens and time, needs about 400,000 TPM per analyzer job, and isn't a replacement for human review in high-impact scenarios. - Preview limits: one input file per request, document analyzers only, no
extract-method fields, no labeled samples.
Content Understanding or Document Intelligence
| Scenario | Choice |
|---|---|
| OCR or layout extraction only | prebuilt-read or prebuilt-layout (lower cost, richer layout) |
| Mostly unstructured documents such as contracts | prebuilt-contract analyzer; it can infer fields that aren't written in the document |
| Custom extraction without labels, unstructured documents | Content Understanding custom analyzer (zero-shot or with a knowledge source) |
| Custom extraction with labels for highly structured documents | Document Intelligence custom model (as few as 5 labeled samples) |
| On-premises or air-gapped deployment | Document Intelligence containers: the only option today |
| Multimodal analysis or RAG-ready preprocessing | Content Understanding prebuilt or custom analyzers |
If you already run Document Intelligence in production, its APIs, endpoints, SDKs and billing are unchanged and no migration is required.
Build and run an analyzer
- A custom analyzer extends a base analyzer through
baseAnalyzerId. Only four base analyzers exist:prebuilt-document,prebuilt-audio,prebuilt-video,prebuilt-image. Useprebuilt-documentfor documents. - Analyzer ID: 1-64 characters, letters, digits, periods and underscores. Create with
PUT .../analyzers/{analyzerId}; analyze withPOST .../analyzers/{analyzerId}:analyze; analysis is asynchronous, so poll theOperation-LocationURL. - The analyzer
modelsproperty takes model names from the Foundry catalog (completion,embedding), not deployment names. At runtime the service maps them to deployments you configure: set resource defaults withPATCH /contentunderstanding/defaultsor passmodelDeploymentsin the analyze request, which overrides the defaults. - Use
contentCategorieswithenableSegmentto classify or split mixed content, such as a PDF with invoices and receipts. Without ananalyzerIdon a category only categorization is done. - Schema tips: write detailed field descriptions with location hints and aliases, use affirmative wording, match the document's language, define repeated data as arrays of objects, and set the method (
extract,generate,classify) explicitly. - Sync limits: 10 MB and 5 pages (only the first five pages are processed unless a page range is given). Async limits: 200 MB and 2000 pages.
- Use API
2025-11-01(GA) for production.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Analyze a document with the Python SDK (long-running operation) | poller = client.begin_analyze(
analyzer_id="prebuilt-invoice",
inputs=[AnalysisInput(url=invoice_url)],
)
result: AnalysisResult = poller.result() | - |
| Install the Content Understanding Python SDK | python -m pip install azure-ai-contentunderstanding | - |
| Create a custom analyzer (REST) | curl -i -X PUT "{endpoint}/contentunderstanding/analyzers/{analyzerId}?api-version=2025-11-01" | - |
| Analyze with an analyzer (REST) | curl -i -X POST "{endpoint}/contentunderstanding/analyzers/{analyzerId}:analyze?api-version=2025-11-01" | - |
Exam Tips
Tick each tip once you can answer it without looking.
“Invoices from many vendors label the same value differently; you want named fields” → Content Understanding analyzer with a schema (semantic field extraction). Trap: OCR alone returns text without meaning or relationships.
“Tables, paragraphs and sections from scanned files; no fields needed” → prebuilt-layout. Trap: prebuilt-read is basic OCR without layout; prebuilt-digitalParse is for digital files.
“Air-gapped or on-premises document processing” → Document Intelligence containers. Trap: Content Understanding isn't listed for this; the page calls containers the only option today.
“Contracts where an end date must be derived from start date and duration” → prebuilt-contract (or a custom Content Understanding analyzer). Trap: Document Intelligence prebuilt models suit standard structured forms.
“Field value chosen from a fixed list, or needs inference” → classify for fixed lists, generate for inference or summary, extract for values written in the content. Trap: extract is supported only for document analyzers.
“Need a 0 to 1 confidence and the source region for each field” → Set estimateFieldSourceAndConfidence = true. Trap: Opt-in, for all field methods. Not on by default.
“Read D(3,1.5,2.0,4.0,0.5)” → Page 3 (one indexed), left, top, width, height. Trap: Five values means the axis-aligned box; the polygon form has eight coordinates.
“Best analyzer to feed a RAG index from PDFs with charts” → prebuilt-documentSearch. Trap: prebuilt-layout and prebuilt-read don't produce figure descriptions or chunks.
“Faster clean Markdown for RAG, no layout-aware analysis” → extractionMode text-only. Trap: tableFormat only sets table output format.
“Analysis Succeeded with warnings and some fields are empty” → Guardrails on the model deployment suppressed field generation; extracted Markdown can remain. Trap: Succeeded doesn't guarantee every field has a value.
“Answer must be calculated or validated from evidence across a document” → Agentic mode: config.workflow = "agentic" (2026-06-01-preview). Trap: For straightforward field extraction use a standard analyzer; agentic costs more tokens and time.
“Custom analyzer for PDFs: which baseAnalyzerId” → prebuilt-document. Trap: Only four base analyzers exist; prebuilt-documentSearch isn't one.
“Which model do you put in the analyzer models property” → A Foundry catalog model name; deployments are mapped by defaults or modelDeployments. Trap: Don't put deployment names there.
“Line items repeated per invoice” → Array of objects in the schema. Trap: Don't ask for JSON text in a string field.
“A 40-page PDF sent synchronously returns only part of the content” → Sync processes the first 5 pages unless a page range is set; use async (up to 2000 pages). Trap: Sync limit is 10 MB and 5 pages.
Sources
- Extract information from documents (training)
- What is Azure Content Understanding in Foundry Tools?
- Content Understanding document overview
- Choose the right Azure AI tool for document processing
- Analyzer configuration and reference
- Prebuilt analyzers
- Agentic mode overview for document analysis
- Best practices for using Content Understanding
- Document elements
- Guardrails in Content Understanding
- Model deployment options for Content Understanding analyzers
- Service quotas and limits
- Content Understanding Studio and Microsoft Foundry
- Create a custom analyzer
- Content Understanding REST API quickstart
Checked against Microsoft Learn on November 13, 2026.