[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69APJF49VHW5A9C76ZGYPTN":3,"skill-same:01M69APJF49VHW5A9C76ZGYPTN":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M69APJF49VHW5A9C76ZGYPTN","azure-ai-formrecognizer-java",null,"Azure AI Document Intelligence SDK for Java (com.azure:azure-ai-documentintelligence).\nUse for extracting text, tables, key-value pairs from documents, receipts, invoices, IDs, or building custom document models.\nTriggers: \"document intelligence java\", \"form recognizer java\", \"extract text from PDF java\", \"OCR document java\",\n\"analyze invoice receipt java\", \"custom document model java\", \"document classification java\".","microsoft\u002Fskills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69AJYYW4E1RMSYCQDJ4FJSH",3204,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fplugins\u002Fazure-sdk-java\u002Fskills\u002Fazure-ai-formrecognizer-java\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"azure ai","azure","azure ai formrecognizer java","java","receipts","value","invoices","tables","key-value","extracting","form","intelligence","model","text","analyze","PDF","ocr","ids","document classification","documents","sdk","2026-11-10 10:12:30",false,"---\nname: azure-ai-formrecognizer-java\ndescription: |\n  Azure AI Document Intelligence SDK for Java (com.azure:azure-ai-documentintelligence).\n  Use for extracting text, tables, key-value pairs from documents, receipts, invoices, IDs, or building custom document models.\n  Triggers: \"document intelligence java\", \"form recognizer java\", \"extract text from PDF java\", \"OCR document java\",\n  \"analyze invoice receipt java\", \"custom document model java\", \"document classification java\".\n---\n\n# Azure AI Document Intelligence SDK for Java\n\n> **Rebranding:** Azure AI Form Recognizer is now **Azure AI Document Intelligence**.\n> New projects should use `com.azure:azure-ai-documentintelligence`. The legacy `azure-ai-formrecognizer` package targets API version 2023-07-31 only.\n> See [Migration Guide](https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Fblob\u002Fmain\u002Fsdk\u002Fdocumentintelligence\u002Fazure-ai-documentintelligence\u002FMIGRATION_GUIDE.md).\n\n## Before Implementation\n\nSearch `microsoft-docs` MCP for current API patterns:\n- Query: `\"azure-ai-documentintelligence Java SDK\"`\n- Verify: Parameters match installed SDK version (latest GA: 1.0.7)\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-ai-documentintelligence\u003C\u002FartifactId>\n    \u003Cversion>1.0.0\u003C\u002Fversion>\n\u003C\u002Fdependency>\n\n\u003C!-- For DefaultAzureCredential -->\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-identity\u003C\u002FartifactId>\n    \u003Cversion>1.14.2\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Environment Variables\n\n```bash\nDOCUMENT_INTELLIGENCE_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\u002F # Required for all auth methods\nAZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production\n```\n\n## Authentication\n\n### DefaultAzureCredential (Recommended)\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceClient;\nimport com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildClient();\n```\n\n### API Key\n\n```java\nimport com.azure.core.credential.AzureKeyCredential;\n\nDocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(new AzureKeyCredential(System.getenv(\"DOCUMENT_INTELLIGENCE_KEY\")))\n    .buildClient();\n```\n\n### Administration Client\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient;\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceAdministrationClient adminClient = new DocumentIntelligenceAdministrationClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildClient();\n```\n\n### Async Client\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceAsyncClient asyncClient = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildAsyncClient();\n```\n\n## Prebuilt Models\n\n| Model ID | Purpose |\n|----------|---------|\n| `prebuilt-read` | Extract text, lines, words, languages |\n| `prebuilt-layout` | Text, tables, selection marks, structure |\n| `prebuilt-receipt` | Receipt data extraction |\n| `prebuilt-invoice` | Invoice field extraction |\n| `prebuilt-idDocument` | ID documents (passport, license) |\n| `prebuilt-tax.us.w2` | US W2 tax forms |\n| `prebuilt-healthInsuranceCard.us` | US health insurance cards |\n| `prebuilt-contract` | Contract field extraction |\n\n> **Retired models:** `prebuilt-businessCard` and `prebuilt-document` are retired in API version 2024-11-30. Use the legacy `azure-ai-formrecognizer` package for these.\n\n## Core Patterns\n\n### Analyze from File\n\n```java\nimport com.azure.ai.documentintelligence.models.*;\nimport com.azure.core.util.BinaryData;\nimport com.azure.core.util.polling.SyncPoller;\nimport java.io.File;\n\nFile document = new File(\"document.pdf\");\nBinaryData documentData = BinaryData.fromFile(document.toPath(), (int) document.length());\n\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-layout\",\n        new AnalyzeDocumentOptions(documentData));\n\nAnalyzeResult result = poller.getFinalResult();\n```\n\n### Analyze from URL\n\n```java\nString documentUrl = \"https:\u002F\u002Fexample.com\u002Finvoice.pdf\";\n\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-invoice\",\n        new AnalyzeDocumentOptions(documentUrl));\n\nAnalyzeResult result = poller.getFinalResult();\n```\n\n### Extract Layout\n\n```java\nAnalyzeResult result = poller.getFinalResult();\n\nfor (DocumentPage page : result.getPages()) {\n    System.out.printf(\"Page has width: %.2f and height: %.2f, measured with unit: %s%n\",\n        page.getWidth(), page.getHeight(), page.getUnit());\n\n    \u002F\u002F Lines\n    for (DocumentLine line : page.getLines()) {\n        System.out.printf(\"Line '%s' is within bounding box %s.%n\",\n            line.getContent(), line.getPolygon());\n    }\n\n    \u002F\u002F Selection marks\n    for (DocumentSelectionMark mark : page.getSelectionMarks()) {\n        System.out.printf(\"Selection mark is '%s' with confidence %.2f.%n\",\n            mark.getState(), mark.getConfidence());\n    }\n}\n\n\u002F\u002F Tables\nfor (DocumentTable table : result.getTables()) {\n    System.out.printf(\"Table: %d rows x %d columns%n\",\n        table.getRowCount(), table.getColumnCount());\n    for (DocumentTableCell cell : table.getCells()) {\n        System.out.printf(\"Cell[%d,%d]: %s%n\",\n            cell.getRowIndex(), cell.getColumnIndex(), cell.getContent());\n    }\n}\n```\n\n### Extract Document Fields\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-receipt\",\n        new AnalyzeDocumentOptions(receiptUrl));\n\nAnalyzeResult result = poller.getFinalResult();\n\nfor (AnalyzedDocument doc : result.getDocuments()) {\n    Map\u003CString, DocumentField> fields = doc.getFields();\n\n    DocumentField merchantName = fields.get(\"MerchantName\");\n    if (merchantName != null && merchantName.getType() == DocumentFieldType.STRING) {\n        System.out.printf(\"Merchant: %s (confidence: %.2f)%n\",\n            merchantName.getValueString(), merchantName.getConfidence());\n    }\n\n    DocumentField transactionDate = fields.get(\"TransactionDate\");\n    if (transactionDate != null && transactionDate.getType() == DocumentFieldType.DATE) {\n        System.out.printf(\"Date: %s%n\", transactionDate.getValueDate());\n    }\n}\n```\n\n### Analyze with Options\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"my-custom-model\",\n        new AnalyzeDocumentOptions(documentUrl)\n            .setPages(Collections.singletonList(\"1-3\"))\n            .setLocale(\"en-US\")\n            .setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES))\n            .setOutputContentFormat(DocumentContentFormat.TEXT));\n```\n\n## Custom Models\n\n### Build Custom Model\n\n```java\nString blobContainerUrl = \"{SAS_URL_of_training_data}\";\n\nSyncPoller\u003CDocumentModelBuildOperationDetails, DocumentModelDetails> poller =\n    adminClient.beginBuildDocumentModel(\n        new BuildDocumentModelOptions(\"my-custom-model\", DocumentBuildMode.TEMPLATE)\n            .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl)));\n\nDocumentModelDetails model = poller.getFinalResult();\nSystem.out.printf(\"Model ID: %s%n\", model.getModelId());\nSystem.out.printf(\"Created: %s%n\", model.getCreatedOn());\n\nmodel.getDocumentTypes().forEach((docType, details) -> {\n    details.getFieldSchema().forEach((field, schema) -> {\n        System.out.printf(\"Field: %s (%s)%n\", field, schema.getType());\n    });\n});\n```\n\n### Manage Models\n\n```java\n\u002F\u002F Resource limits\nDocumentIntelligenceResourceDetails resourceDetails = adminClient.getResourceDetails();\nSystem.out.printf(\"Models: %d \u002F %d%n\",\n    resourceDetails.getCustomDocumentModels().getCount(),\n    resourceDetails.getCustomDocumentModels().getLimit());\n\n\u002F\u002F List models\nPagedIterable\u003CDocumentModelDetails> models = adminClient.listModels();\nfor (DocumentModelDetails model : models) {\n    System.out.printf(\"Model: %s, Created: %s%n\",\n        model.getModelId(), model.getCreatedOn());\n}\n\n\u002F\u002F Get model\nDocumentModelDetails model = adminClient.getModel(\"model-id\");\n\n\u002F\u002F Delete model\nadminClient.deleteModel(\"model-id\");\n```\n\n## Document Classification\n\n### Build Classifier\n\n```java\nMap\u003CString, ClassifierDocumentTypeDetails> docTypes = new HashMap\u003C>();\ndocTypes.put(\"invoice\", new ClassifierDocumentTypeDetails()\n    .setAzureBlobSource(new AzureBlobContentSource(containerUrl).setPrefix(\"invoices\u002F\")));\ndocTypes.put(\"receipt\", new ClassifierDocumentTypeDetails()\n    .setAzureBlobSource(new AzureBlobContentSource(containerUrl).setPrefix(\"receipts\u002F\")));\n\nSyncPoller\u003CDocumentClassifierBuildOperationDetails, DocumentClassifierDetails> poller =\n    adminClient.beginBuildClassifier(\n        new BuildDocumentClassifierOptions(\"my-classifier\", docTypes));\n\nDocumentClassifierDetails classifier = poller.getFinalResult();\n```\n\n### Classify Document\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginClassifyDocument(\"my-classifier\",\n        new ClassifyDocumentOptions(documentUrl));\n\nAnalyzeResult result = poller.getFinalResult();\nfor (AnalyzedDocument doc : result.getDocuments()) {\n    System.out.printf(\"Classified as: %s (confidence: %.2f)%n\",\n        doc.getDocumentType(), doc.getConfidence());\n}\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\n\ntry {\n    client.beginAnalyzeDocument(\"prebuilt-receipt\",\n        new AnalyzeDocumentOptions(\"invalid-url\"));\n} catch (HttpResponseException e) {\n    System.out.printf(\"Status: %d, Error: %s%n\",\n        e.getResponse().getStatusCode(), e.getMessage());\n}\n```\n\n## Migration from azure-ai-formrecognizer\n\n| Old (formrecognizer v4.x) | New (documentintelligence v1.x) |\n|---|---|\n| `DocumentAnalysisClient` | `DocumentIntelligenceClient` |\n| `DocumentAnalysisClientBuilder` | `DocumentIntelligenceClientBuilder` |\n| `DocumentModelAdministrationClient` | `DocumentIntelligenceAdministrationClient` |\n| `beginAnalyzeDocumentFromUrl(modelId, url)` | `beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(url))` |\n| `beginAnalyzeDocument(modelId, data)` | `beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(data))` |\n| `SyncPoller\u003COperationResult, AnalyzeResult>` | `SyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult>` |\n| `field.getValueAsString()` | `field.getValueString()` |\n| `field.getValueAsDate()` | `field.getValueDate()` |\n| `field.getValueAsDouble()` | `field.getValueNumber()` |\n| `field.getValueAsList()` | `field.getValueList()` |\n| `field.getValueAsMap()` | `field.getValueObject()` |\n| `mark.getSelectionMarkState()` | `mark.getState()` |\n| `adminClient.beginBuildDocumentModel(url, mode, prefix, options, ctx)` | `adminClient.beginBuildDocumentModel(new BuildDocumentModelOptions(id, mode).setAzureBlobSource(...))` |\n| `adminClient.getResourceDetails()` → `.getCustomDocumentModelCount()` | `adminClient.getResourceDetails()` → `.getCustomDocumentModels().getCount()` |\n| `FORM_RECOGNIZER_ENDPOINT` | `DOCUMENT_INTELLIGENCE_ENDPOINT` |\n\n## Reference Files\n\n| File | Contents |\n|------|----------|\n| [references\u002Fexamples.md](references\u002Fexamples.md) | Complete code examples for all scenarios |\n","# Azure AI Document Intelligence SDK for Java\n\n> **Rebranding:** Azure AI Form Recognizer is now **Azure AI Document Intelligence**.\n> New projects should use `com.azure:azure-ai-documentintelligence`. The legacy `azure-ai-formrecognizer` package targets API version 2023-07-31 only.\n> See [Migration Guide](https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Fblob\u002Fmain\u002Fsdk\u002Fdocumentintelligence\u002Fazure-ai-documentintelligence\u002FMIGRATION_GUIDE.md).\n\n## Before Implementation\n\nSearch `microsoft-docs` MCP for current API patterns:\n- Query: `\"azure-ai-documentintelligence Java SDK\"`\n- Verify: Parameters match installed SDK version (latest GA: 1.0.7)\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-ai-documentintelligence\u003C\u002FartifactId>\n    \u003Cversion>1.0.0\u003C\u002Fversion>\n\u003C\u002Fdependency>\n\n\u003C!-- For DefaultAzureCredential -->\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-identity\u003C\u002FartifactId>\n    \u003Cversion>1.14.2\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Environment Variables\n\n```bash\nDOCUMENT_INTELLIGENCE_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\u002F # Required for all auth methods\nAZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production\n```\n\n## Authentication\n\n### DefaultAzureCredential (Recommended)\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceClient;\nimport com.azure.ai.documentintelligence.DocumentIntelligenceClientBuilder;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildClient();\n```\n\n### API Key\n\n```java\nimport com.azure.core.credential.AzureKeyCredential;\n\nDocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(new AzureKeyCredential(System.getenv(\"DOCUMENT_INTELLIGENCE_KEY\")))\n    .buildClient();\n```\n\n### Administration Client\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClient;\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAdministrationClientBuilder;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceAdministrationClient adminClient = new DocumentIntelligenceAdministrationClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildClient();\n```\n\n### Async Client\n\n```java\nimport com.azure.ai.documentintelligence.DocumentIntelligenceAsyncClient;\nimport com.azure.core.credential.TokenCredential;\nimport com.azure.identity.AzureIdentityEnvVars;\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.identity.ManagedIdentityCredentialBuilder;\n\nTokenCredential credential = new DefaultAzureCredentialBuilder()\n    .requireEnvVars(AzureIdentityEnvVars.AZURE_TOKEN_CREDENTIALS)\n    .build();\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-java-stable#credential-classes\n\u002F\u002F TokenCredential credential = new ManagedIdentityCredentialBuilder().build();\n\nDocumentIntelligenceAsyncClient asyncClient = new DocumentIntelligenceClientBuilder()\n    .endpoint(System.getenv(\"DOCUMENT_INTELLIGENCE_ENDPOINT\"))\n    .credential(credential)\n    .buildAsyncClient();\n```\n\n## Prebuilt Models\n\n| Model ID | Purpose |\n|----------|---------|\n| `prebuilt-read` | Extract text, lines, words, languages |\n| `prebuilt-layout` | Text, tables, selection marks, structure |\n| `prebuilt-receipt` | Receipt data extraction |\n| `prebuilt-invoice` | Invoice field extraction |\n| `prebuilt-idDocument` | ID documents (passport, license) |\n| `prebuilt-tax.us.w2` | US W2 tax forms |\n| `prebuilt-healthInsuranceCard.us` | US health insurance cards |\n| `prebuilt-contract` | Contract field extraction |\n\n> **Retired models:** `prebuilt-businessCard` and `prebuilt-document` are retired in API version 2024-11-30. Use the legacy `azure-ai-formrecognizer` package for these.\n\n## Core Patterns\n\n### Analyze from File\n\n```java\nimport com.azure.ai.documentintelligence.models.*;\nimport com.azure.core.util.BinaryData;\nimport com.azure.core.util.polling.SyncPoller;\nimport java.io.File;\n\nFile document = new File(\"document.pdf\");\nBinaryData documentData = BinaryData.fromFile(document.toPath(), (int) document.length());\n\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-layout\",\n        new AnalyzeDocumentOptions(documentData));\n\nAnalyzeResult result = poller.getFinalResult();\n```\n\n### Analyze from URL\n\n```java\nString documentUrl = \"https:\u002F\u002Fexample.com\u002Finvoice.pdf\";\n\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-invoice\",\n        new AnalyzeDocumentOptions(documentUrl));\n\nAnalyzeResult result = poller.getFinalResult();\n```\n\n### Extract Layout\n\n```java\nAnalyzeResult result = poller.getFinalResult();\n\nfor (DocumentPage page : result.getPages()) {\n    System.out.printf(\"Page has width: %.2f and height: %.2f, measured with unit: %s%n\",\n        page.getWidth(), page.getHeight(), page.getUnit());\n\n    \u002F\u002F Lines\n    for (DocumentLine line : page.getLines()) {\n        System.out.printf(\"Line '%s' is within bounding box %s.%n\",\n            line.getContent(), line.getPolygon());\n    }\n\n    \u002F\u002F Selection marks\n    for (DocumentSelectionMark mark : page.getSelectionMarks()) {\n        System.out.printf(\"Selection mark is '%s' with confidence %.2f.%n\",\n            mark.getState(), mark.getConfidence());\n    }\n}\n\n\u002F\u002F Tables\nfor (DocumentTable table : result.getTables()) {\n    System.out.printf(\"Table: %d rows x %d columns%n\",\n        table.getRowCount(), table.getColumnCount());\n    for (DocumentTableCell cell : table.getCells()) {\n        System.out.printf(\"Cell[%d,%d]: %s%n\",\n            cell.getRowIndex(), cell.getColumnIndex(), cell.getContent());\n    }\n}\n```\n\n### Extract Document Fields\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"prebuilt-receipt\",\n        new AnalyzeDocumentOptions(receiptUrl));\n\nAnalyzeResult result = poller.getFinalResult();\n\nfor (AnalyzedDocument doc : result.getDocuments()) {\n    Map\u003CString, DocumentField> fields = doc.getFields();\n\n    DocumentField merchantName = fields.get(\"MerchantName\");\n    if (merchantName != null && merchantName.getType() == DocumentFieldType.STRING) {\n        System.out.printf(\"Merchant: %s (confidence: %.2f)%n\",\n            merchantName.getValueString(), merchantName.getConfidence());\n    }\n\n    DocumentField transactionDate = fields.get(\"TransactionDate\");\n    if (transactionDate != null && transactionDate.getType() == DocumentFieldType.DATE) {\n        System.out.printf(\"Date: %s%n\", transactionDate.getValueDate());\n    }\n}\n```\n\n### Analyze with Options\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginAnalyzeDocument(\"my-custom-model\",\n        new AnalyzeDocumentOptions(documentUrl)\n            .setPages(Collections.singletonList(\"1-3\"))\n            .setLocale(\"en-US\")\n            .setDocumentAnalysisFeatures(Arrays.asList(DocumentAnalysisFeature.LANGUAGES))\n            .setOutputContentFormat(DocumentContentFormat.TEXT));\n```\n\n## Custom Models\n\n### Build Custom Model\n\n```java\nString blobContainerUrl = \"{SAS_URL_of_training_data}\";\n\nSyncPoller\u003CDocumentModelBuildOperationDetails, DocumentModelDetails> poller =\n    adminClient.beginBuildDocumentModel(\n        new BuildDocumentModelOptions(\"my-custom-model\", DocumentBuildMode.TEMPLATE)\n            .setAzureBlobSource(new AzureBlobContentSource(blobContainerUrl)));\n\nDocumentModelDetails model = poller.getFinalResult();\nSystem.out.printf(\"Model ID: %s%n\", model.getModelId());\nSystem.out.printf(\"Created: %s%n\", model.getCreatedOn());\n\nmodel.getDocumentTypes().forEach((docType, details) -> {\n    details.getFieldSchema().forEach((field, schema) -> {\n        System.out.printf(\"Field: %s (%s)%n\", field, schema.getType());\n    });\n});\n```\n\n### Manage Models\n\n```java\n\u002F\u002F Resource limits\nDocumentIntelligenceResourceDetails resourceDetails = adminClient.getResourceDetails();\nSystem.out.printf(\"Models: %d \u002F %d%n\",\n    resourceDetails.getCustomDocumentModels().getCount(),\n    resourceDetails.getCustomDocumentModels().getLimit());\n\n\u002F\u002F List models\nPagedIterable\u003CDocumentModelDetails> models = adminClient.listModels();\nfor (DocumentModelDetails model : models) {\n    System.out.printf(\"Model: %s, Created: %s%n\",\n        model.getModelId(), model.getCreatedOn());\n}\n\n\u002F\u002F Get model\nDocumentModelDetails model = adminClient.getModel(\"model-id\");\n\n\u002F\u002F Delete model\nadminClient.deleteModel(\"model-id\");\n```\n\n## Document Classification\n\n### Build Classifier\n\n```java\nMap\u003CString, ClassifierDocumentTypeDetails> docTypes = new HashMap\u003C>();\ndocTypes.put(\"invoice\", new ClassifierDocumentTypeDetails()\n    .setAzureBlobSource(new AzureBlobContentSource(containerUrl).setPrefix(\"invoices\u002F\")));\ndocTypes.put(\"receipt\", new ClassifierDocumentTypeDetails()\n    .setAzureBlobSource(new AzureBlobContentSource(containerUrl).setPrefix(\"receipts\u002F\")));\n\nSyncPoller\u003CDocumentClassifierBuildOperationDetails, DocumentClassifierDetails> poller =\n    adminClient.beginBuildClassifier(\n        new BuildDocumentClassifierOptions(\"my-classifier\", docTypes));\n\nDocumentClassifierDetails classifier = poller.getFinalResult();\n```\n\n### Classify Document\n\n```java\nSyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult> poller =\n    client.beginClassifyDocument(\"my-classifier\",\n        new ClassifyDocumentOptions(documentUrl));\n\nAnalyzeResult result = poller.getFinalResult();\nfor (AnalyzedDocument doc : result.getDocuments()) {\n    System.out.printf(\"Classified as: %s (confidence: %.2f)%n\",\n        doc.getDocumentType(), doc.getConfidence());\n}\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\n\ntry {\n    client.beginAnalyzeDocument(\"prebuilt-receipt\",\n        new AnalyzeDocumentOptions(\"invalid-url\"));\n} catch (HttpResponseException e) {\n    System.out.printf(\"Status: %d, Error: %s%n\",\n        e.getResponse().getStatusCode(), e.getMessage());\n}\n```\n\n## Migration from azure-ai-formrecognizer\n\n| Old (formrecognizer v4.x) | New (documentintelligence v1.x) |\n|---|---|\n| `DocumentAnalysisClient` | `DocumentIntelligenceClient` |\n| `DocumentAnalysisClientBuilder` | `DocumentIntelligenceClientBuilder` |\n| `DocumentModelAdministrationClient` | `DocumentIntelligenceAdministrationClient` |\n| `beginAnalyzeDocumentFromUrl(modelId, url)` | `beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(url))` |\n| `beginAnalyzeDocument(modelId, data)` | `beginAnalyzeDocument(modelId, new AnalyzeDocumentOptions(data))` |\n| `SyncPoller\u003COperationResult, AnalyzeResult>` | `SyncPoller\u003CAnalyzeOperationDetails, AnalyzeResult>` |\n| `field.getValueAsString()` | `field.getValueString()` |\n| `field.getValueAsDate()` | `field.getValueDate()` |\n| `field.getValueAsDouble()` | `field.getValueNumber()` |\n| `field.getValueAsList()` | `field.getValueList()` |\n| `field.getValueAsMap()` | `field.getValueObject()` |\n| `mark.getSelectionMarkState()` | `mark.getState()` |\n| `adminClient.beginBuildDocumentModel(url, mode, prefix, options, ctx)` | `adminClient.beginBuildDocumentModel(new BuildDocumentModelOptions(id, mode).setAzureBlobSource(...))` |\n| `adminClient.getResourceDetails()` → `.getCustomDocumentModelCount()` | `adminClient.getResourceDetails()` → `.getCustomDocumentModels().getCount()` |\n| `FORM_RECOGNIZER_ENDPOINT` | `DOCUMENT_INTELLIGENCE_ENDPOINT` |\n\n## Reference Files\n\n| File | Contents |\n|------|----------|\n| [references\u002Fexamples.md](references\u002Fexamples.md) | Complete code examples for all scenarios |\n",{"name":5,"description":7},"main","3f5b461b2314e01c400564051e92469114c5b68f",".github\u002Fplugins\u002Fazure-sdk-java\u002Fskills\u002Fazure-ai-formrecognizer-java",368,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills","https:\u002F\u002Fmicrosoft.github.io\u002Fskills\u002F","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 06:48:25",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add microsoft\u002Fskills --skill azure-ai-formrecognizer-java",{"tool":66,"command":67},"bunx","bunx skills add microsoft\u002Fskills --skill azure-ai-formrecognizer-java",{"tool":69,"command":70},"pnpm","pnpm dlx skills add microsoft\u002Fskills --skill azure-ai-formrecognizer-java","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fplugins\u002Fazure-sdk-java\u002Fskills\u002Fazure-ai-formrecognizer-java\u002FSKILL.md",true,[74],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fexamples.md","REFERENCE","参考文档",20841,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fplugins\u002Fazure-sdk-java\u002Fskills\u002Fazure-ai-formrecognizer-java\u002Freferences\u002Fexamples.md",[81,89,116,152,179,199],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":88},"01M741JBE1VH8A2Y3FXX2P7386","azure-advisor-cost-optimization","Analyze Azure Advisor Cost\u002FIdleResources findings and prevalidate deletion safety, including Service Groups. WHEN: \"find unused Azure resources\", \"what resources am I paying for but no longer using\", \"idle-resource savings\", \"historical idle-resource savings\", \"are these idle resources safe to delete\". Generic Cost, other subcategories, and cross-category requests use azure-advisor.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fplugins\u002Fazure-advisor\u002Fskills\u002Fazure-advisor-cost-optimization\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":98,"publishedAt":45},"01M69B4JCRQV5SPXAFCKXQRV0H","skill-creator","Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services. Use when creating new skills or updating existing skills.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fskill-creator\u002FSKILL.md",[95],{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[99,100,101,102,9,25,103,104,105,106,107,108,109,110,111,112,113,114,115],"skill creator","creator","ai coding agents","coding agents","foundry","microsoft foundry","coding","guide","for","use","Existing","services","new","when","sdks","with","ai coding",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":132,"publishedAt":45},"01M69B4FD57V1MYKRWAJJECTZ7","podcast-generation","Generate AI-powered podcast-style audio narratives using Azure OpenAI's GPT Realtime Mini model via WebSocket. Use when building text-to-speech features, audio narrative generation, podcast creation from content, or integrating with Azure OpenAI Realtime API for real audio output. Covers full-stack implementation from React frontend to Python FastAPI backend with WebSocket streaming.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpodcast-generation\u002FSKILL.md",[122,125,128,131],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":129,"categoryName":130,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},[133,134,135,136,25,137,138,139,140,141,142,36,143,144,145,112,146,147,37,148,149,150,151],"podcast generation","generation","podcast","frontend","azure openai","realtime","react","python","Audio","creation","fastapi backend","python fastapi","fastapi","api","streaming","narrative","stack","generate","features",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":159,"publishedAt":45},"01M69B4CYPM5SESY5ZWEFDXEQZ","microsoft-docs","Understand Microsoft technologies by querying official documentation. Use whenever the user asks how something works, wants tutorials, needs configuration options, limits, quotas, or best practices for any Microsoft technology (Azure, .NET, M365, Windows, Power Platform, etc.)—even if they don't mention \"docs.\" If the question is about understanding a concept rather than writing code, this is the right skill.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fmicrosoft-docs\u002FSKILL.md",[158],{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},[160,9,161,162,163,164,165,25,166,167,168,169,170,171,172,173,107,174,63,175,108,176,177,178],"microsoft docs","docs","documentation","windows","official","cli","MCP","writing","power platform","mcp server","back","concept","power","platform","technology","question","learn mcp","learn","best practices",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":186,"publishedAt":45},"01M69B49C3YPD1ZJ3NC0HPCY58","mcp-builder","Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP), Node\u002FTypeScript (MCP SDK), or C#\u002F.NET (Microsoft MCP SDK).","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fmcp-builder\u002FSKILL.md",[185],{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},[187,166,188,189,44,9,140,190,191,36,192,112,193,194,195,106,196,197,107,198,108,114],"mcp builder","builder","llms","typescript","model context protocol","building mcp servers","node","integrate","Tools","context","fastmcp","mcp sdk",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":217,"publishedAt":45},"01M69B467A7CDMFQ0T6Q0ZA12Q","kql","KQL language expertise for writing correct, efficient Kusto Query Language queries. Covers syntax gotchas, join patterns, dynamic types, datetime pitfalls, regex patterns, serialization, memory management, result-size discipline, and advanced functions (geo, vector, graph). USE THIS SKILL whenever writing, debugging, or reviewing KQL queries — even simple ones — because the gotchas section prevents the most common errors that waste tool calls and cause expensive retry cascades. Trigger on: KQL, Kusto, ADX, Azure Data Explorer, Fabric Real-Time Intelligence, EventHouse, Log Analytics, log analysis, data exploration, time series, anomaly detection, summarize, where clause, join, extend, project, let statement, parse operator, extract function, any mention of pipe-forward query syntax.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fkql\u002FSKILL.md",[205,208,209,214],{"categoryNo":206,"categoryName":207,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":210,"categoryName":211,"taxonomyType":212,"taxonomyTypeDesc":213},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",{"categoryNo":215,"categoryName":216,"taxonomyType":212,"taxonomyTypeDesc":213},"01JBSEEDCAT000000000000036","内容创作者",[201,25,167,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,107,234,235,236],"analytics","memory","summarize","exploration","parse","project","time","vector","join","log","pipe","datetime","discipline","time series","regex","anomaly","section","tool","geo"]