azure-docs-sdk-java/docs-ref-autogen/com.azure.ai.formrecognizer...

486 строки
128 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.ai.formrecognizer.FormRecognizerClient"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient"
name: "FormRecognizerClient"
nameWithType: "FormRecognizerClient"
summary: "This class provides an synchronous client to connect to the Form Recognizer Azure Cognitive Service."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **FormRecognizerClient**"
methods:
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCards(java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCards(InputStream businessCard, long length)"
name: "beginRecognizeBusinessCards(InputStream businessCard, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeBusinessCards(InputStream businessCard, long length)"
summary: "Recognizes business card data from the provided document data using optical character recognition (OCR) and a prebuilt trained business card model."
parameters:
- description: "The data of the business card to recognize business card information from."
name: "businessCard"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCards(InputStream businessCard, long length)"
desc: "Recognizes business card data from the provided document data using optical character recognition (OCR) and a prebuilt trained business card model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a business card.\n\n**Code sample**\n\n```java\nFile businessCard = new File(\"{local/file_path/fileName.jpg}\");\n byte[] fileContent = Files.readAllBytes(businessCard.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n formRecognizerClient.beginRecognizeBusinessCards(targetStream, businessCard.length()).getFinalResult()\n .forEach(recognizedBusinessCard -> {\n Map<String, FormField> recognizedFields = recognizedBusinessCard.getFields();\n FormField contactNamesFormField = recognizedFields.get(\"ContactNames\");\n if (contactNamesFormField != null) {\n if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {\n List<FormField> contactNamesList = contactNamesFormField.getValue().asList();\n contactNamesList.stream()\n .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())\n .map(contactName -> {\n System.out.printf(\"Contact name: %s%n\", contactName.getValueData().getText());\n return contactName.getValue().asMap();\n })\n .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {\n if (\"FirstName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String firstName = contactName.getValue().asString();\n System.out.printf(\"\\tFirst Name: %s, confidence: %.2f%n\",\n firstName, contactName.getConfidence());\n }\n }\n if (\"LastName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String lastName = contactName.getValue().asString();\n System.out.printf(\"\\tLast Name: %s, confidence: %.2f%n\",\n lastName, contactName.getConfidence());\n }\n }\n }));\n }\n }\n FormField jobTitles = recognizedFields.get(\"JobTitles\");\n if (jobTitles != null) {\n if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {\n List<FormField> jobTitlesItems = jobTitles.getValue().asList();\n jobTitlesItems.forEach(jobTitlesItem -> {\n if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {\n String jobTitle = jobTitlesItem.getValue().asString();\n System.out.printf(\"Job Title: %s, confidence: %.2f%n\",\n jobTitle, jobTitlesItem.getConfidence());\n }\n });\n }\n }\n });\n }\n```\n\n\n[here]: https://aka.ms/formrecognizer/businesscardfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize business card operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCards(java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCards(InputStream businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
name: "beginRecognizeBusinessCards(InputStream businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeBusinessCards(InputStream businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
summary: "Recognizes business card data from the provided document data using optical character recognition (OCR) and a prebuilt trained business card model."
parameters:
- description: "The data of the business card to recognize business card information from."
name: "businessCard"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing a business card."
name: "recognizeBusinessCardsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions&text=RecognizeBusinessCardsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCards(InputStream businessCard, long length, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
desc: "Recognizes business card data from the provided document data using optical character recognition (OCR) and a prebuilt trained business card model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a business card.\n\n**Code sample**\n\n```java\nFile businessCard = new File(\"{local/file_path/fileName.jpg}\");\n boolean includeFieldElements = true;\n byte[] fileContent = Files.readAllBytes(businessCard.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n for (RecognizedForm recognizedForm : formRecognizerClient.beginRecognizeBusinessCards(targetStream,\n businessCard.length(),\n new RecognizeBusinessCardsOptions()\n .setContentType(FormContentType.IMAGE_JPEG)\n .setFieldElementsIncluded(includeFieldElements),\n Context.NONE).setPollInterval(Duration.ofSeconds(5))\n .getFinalResult()) {\n Map<String, FormField> recognizedFields = recognizedForm.getFields();\n FormField contactNamesFormField = recognizedFields.get(\"ContactNames\");\n if (contactNamesFormField != null) {\n if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {\n List<FormField> contactNamesList = contactNamesFormField.getValue().asList();\n contactNamesList.stream()\n .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())\n .map(contactName -> {\n System.out.printf(\"Contact name: %s%n\", contactName.getValueData().getText());\n return contactName.getValue().asMap();\n })\n .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {\n if (\"FirstName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String firstName = contactName.getValue().asString();\n System.out.printf(\"\\tFirst Name: %s, confidence: %.2f%n\",\n firstName, contactName.getConfidence());\n }\n }\n if (\"LastName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String lastName = contactName.getValue().asString();\n System.out.printf(\"\\tLast Name: %s, confidence: %.2f%n\",\n lastName, contactName.getConfidence());\n }\n }\n }));\n }\n }\n FormField jobTitles = recognizedFields.get(\"JobTitles\");\n if (jobTitles != null) {\n if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {\n List<FormField> jobTitlesItems = jobTitles.getValue().asList();\n jobTitlesItems.forEach(jobTitlesItem -> {\n if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {\n String jobTitle = jobTitlesItem.getValue().asString();\n System.out.printf(\"Job Title: %s, confidence: %.2f%n\",\n jobTitle, jobTitlesItem.getConfidence());\n }\n });\n }\n }\n }\n }\n```\n\n\n[here]: https://aka.ms/formrecognizer/businesscardfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize business card operation until it has completed, has failed,\n or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(String businessCardUrl)"
name: "beginRecognizeBusinessCardsFromUrl(String businessCardUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(String businessCardUrl)"
summary: "Recognizes business card data from document using optical character recognition (OCR) and a prebuilt business card trained model."
parameters:
- description: "The source URL to the input business card."
name: "businessCardUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl)"
desc: "Recognizes business card data from document using optical character recognition (OCR) and a prebuilt business card trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a business card.\n\n**Code sample**\n\n```java\nString businessCardUrl = \"{business_card_url}\";\n formRecognizerClient.beginRecognizeBusinessCardsFromUrl(businessCardUrl)\n .getFinalResult()\n .forEach(recognizedBusinessCard -> {\n Map<String, FormField> recognizedFields = recognizedBusinessCard.getFields();\n FormField contactNamesFormField = recognizedFields.get(\"ContactNames\");\n if (contactNamesFormField != null) {\n if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {\n List<FormField> contactNamesList = contactNamesFormField.getValue().asList();\n contactNamesList.stream()\n .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())\n .map(contactName -> {\n System.out.printf(\"Contact name: %s%n\", contactName.getValueData().getText());\n return contactName.getValue().asMap();\n })\n .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {\n if (\"FirstName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String firstName = contactName.getValue().asString();\n System.out.printf(\"\\tFirst Name: %s, confidence: %.2f%n\",\n firstName, contactName.getConfidence());\n }\n }\n if (\"LastName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String lastName = contactName.getValue().asString();\n System.out.printf(\"\\tLast Name: %s, confidence: %.2f%n\",\n lastName, contactName.getConfidence());\n }\n }\n }));\n }\n }\n FormField jobTitles = recognizedFields.get(\"JobTitles\");\n if (jobTitles != null) {\n if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {\n List<FormField> jobTitlesItems = jobTitles.getValue().asList();\n jobTitlesItems.forEach(jobTitlesItem -> {\n if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {\n String jobTitle = jobTitlesItem.getValue().asString();\n System.out.printf(\"Job Title: %s, confidence: %.2f%n\",\n jobTitle, jobTitlesItem.getConfidence());\n }\n });\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/businesscardfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize business card operation until it has\n completed, has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(java.lang.String,com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
name: "beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
summary: "Recognizes business card data from documents using optical character recognition (OCR) and a prebuilt business card trained model."
parameters:
- description: "The source URL to the input business card."
name: "businessCardUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing a business card."
name: "recognizeBusinessCardsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeBusinessCardsOptions&text=RecognizeBusinessCardsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeBusinessCardsFromUrl(String businessCardUrl, RecognizeBusinessCardsOptions recognizeBusinessCardsOptions, Context context)"
desc: "Recognizes business card data from documents using optical character recognition (OCR) and a prebuilt business card trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a business card.\n\n**Code sample**\n\n```java\nString businessCardUrl = \"{business_card_url}\";\n formRecognizerClient.beginRecognizeBusinessCardsFromUrl(businessCardUrl,\n new RecognizeBusinessCardsOptions()\n .setFieldElementsIncluded(true), Context.NONE)\n .setPollInterval(Duration.ofSeconds(5)).getFinalResult()\n .forEach(recognizedBusinessCard -> {\n Map<String, FormField> recognizedFields = recognizedBusinessCard.getFields();\n FormField contactNamesFormField = recognizedFields.get(\"ContactNames\");\n if (contactNamesFormField != null) {\n if (FieldValueType.LIST == contactNamesFormField.getValue().getValueType()) {\n List<FormField> contactNamesList = contactNamesFormField.getValue().asList();\n contactNamesList.stream()\n .filter(contactName -> FieldValueType.MAP == contactName.getValue().getValueType())\n .map(contactName -> {\n System.out.printf(\"Contact name: %s%n\", contactName.getValueData().getText());\n return contactName.getValue().asMap();\n })\n .forEach(contactNamesMap -> contactNamesMap.forEach((key, contactName) -> {\n if (\"FirstName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String firstName = contactName.getValue().asString();\n System.out.printf(\"\\tFirst Name: %s, confidence: %.2f%n\",\n firstName, contactName.getConfidence());\n }\n }\n if (\"LastName\".equals(key)) {\n if (FieldValueType.STRING == contactName.getValue().getValueType()) {\n String lastName = contactName.getValue().asString();\n System.out.printf(\"\\tLast Name: %s, confidence: %.2f%n\",\n lastName, contactName.getConfidence());\n }\n }\n }));\n }\n }\n FormField jobTitles = recognizedFields.get(\"JobTitles\");\n if (jobTitles != null) {\n if (FieldValueType.LIST == jobTitles.getValue().getValueType()) {\n List<FormField> jobTitlesItems = jobTitles.getValue().asList();\n jobTitlesItems.forEach(jobTitlesItem -> {\n if (FieldValueType.STRING == jobTitlesItem.getValue().getValueType()) {\n String jobTitle = jobTitlesItem.getValue().asString();\n System.out.printf(\"Job Title: %s, confidence: %.2f%n\",\n jobTitle, jobTitlesItem.getConfidence());\n }\n });\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/businesscardfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize business card operation until it has\n completed, has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContent(java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContent(InputStream form, long length)"
name: "beginRecognizeContent(InputStream form, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeContent(InputStream form, long length)"
summary: "Recognizes layout data using optical character recognition (OCR) and a custom trained model."
parameters:
- description: "The data of the form to recognize content information from."
name: "form"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContent(InputStream form, long length)"
desc: "Recognizes layout data using optical character recognition (OCR) and a custom trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.\n\n**Code sample**\n\n```java\nFile form = new File(\"{local/file_path/fileName.pdf}\");\n byte[] fileContent = Files.readAllBytes(form.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n formRecognizerClient.beginRecognizeContent(targetStream, form.length())\n .getFinalResult()\n .forEach(formPage -> {\n System.out.printf(\"Page Angle: %s%n\", formPage.getTextAngle());\n System.out.printf(\"Page Dimension unit: %s%n\", formPage.getUnit());\n // Table information\n System.out.println(\"Recognized Tables: \");\n formPage.getTables()\n .stream()\n .flatMap(formTable -> formTable.getCells().stream())\n .forEach(recognizedTableCell -> System.out.printf(\"%s \", recognizedTableCell.getText()));\n });\n }\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize content operation until it has completed, has failed,\n or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.FormPage\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FormPage\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormPage?alt=com.azure.ai.formrecognizer.models.FormPage&text=FormPage\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContent(java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeContentOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContent(InputStream form, long length, RecognizeContentOptions recognizeContentOptions, Context context)"
name: "beginRecognizeContent(InputStream form, long length, RecognizeContentOptions recognizeContentOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeContent(InputStream form, long length, RecognizeContentOptions recognizeContentOptions, Context context)"
summary: "Recognizes content/layout data from the provided document data using optical character recognition (OCR)."
parameters:
- description: "The data of the form to recognize content information from."
name: "form"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when recognizing content/layout on a form."
name: "recognizeContentOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions?alt=com.azure.ai.formrecognizer.models.RecognizeContentOptions&text=RecognizeContentOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContent(InputStream form, long length, RecognizeContentOptions recognizeContentOptions, Context context)"
desc: "Recognizes content/layout data from the provided document data using optical character recognition (OCR).\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nContent recognition supports auto language identification and multilanguage documents, so only provide a language code if you would like to force the documented to be processed as that specific language in the <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>.\n\n**Code sample**\n\n```java\nFile form = new File(\"{file_source_url}\");\n byte[] fileContent = Files.readAllBytes(form.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n\n for (FormPage formPage : formRecognizerClient.beginRecognizeContent(targetStream, form.length(),\n new RecognizeContentOptions()\n .setPollInterval(Duration.ofSeconds(5)), Context.NONE)\n .getFinalResult()) {\n System.out.printf(\"Page Angle: %s%n\", formPage.getTextAngle());\n System.out.printf(\"Page Dimension unit: %s%n\", formPage.getUnit());\n // Table information\n System.out.println(\"Recognized Tables: \");\n formPage.getTables()\n .stream()\n .flatMap(formTable -> formTable.getCells().stream())\n .forEach(recognizedTableCell -> System.out.printf(\"%s \", recognizedTableCell.getText()));\n }\n }\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize content operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.FormPage\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FormPage\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormPage?alt=com.azure.ai.formrecognizer.models.FormPage&text=FormPage\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContentFromUrl(java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContentFromUrl(String formUrl)"
name: "beginRecognizeContentFromUrl(String formUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeContentFromUrl(String formUrl)"
summary: "Recognizes content/layout data from documents using optical character recognition (OCR)."
parameters:
- description: "The URL of the form to analyze."
name: "formUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContentFromUrl(String formUrl)"
desc: "Recognizes content/layout data from documents using optical character recognition (OCR).\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.\n\n**Code sample**\n\n```java\nString formUrl = \"{form_url}\";\n formRecognizerClient.beginRecognizeContentFromUrl(formUrl)\n .getFinalResult()\n .forEach(formPage -> {\n System.out.printf(\"Page Angle: %s%n\", formPage.getTextAngle());\n System.out.printf(\"Page Dimension unit: %s%n\", formPage.getUnit());\n // Table information\n System.out.println(\"Recognized Tables: \");\n formPage.getTables()\n .stream()\n .flatMap(formTable -> formTable.getCells().stream())\n .forEach(recognizedTableCell -> System.out.printf(\"%s \", recognizedTableCell.getText()));\n });\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize content form operation until it has completed, has failed,\n or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.FormPage\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FormPage\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormPage?alt=com.azure.ai.formrecognizer.models.FormPage&text=FormPage\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContentFromUrl(java.lang.String,com.azure.ai.formrecognizer.models.RecognizeContentOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions, Context context)"
name: "beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions, Context context)"
summary: "Recognizes content/layout data using optical character recognition (OCR)."
parameters:
- description: "The source URL to the input form."
name: "formUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when recognizing content/layout on a form."
name: "recognizeContentOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions?alt=com.azure.ai.formrecognizer.models.RecognizeContentOptions&text=RecognizeContentOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<FormPage>> beginRecognizeContentFromUrl(String formUrl, RecognizeContentOptions recognizeContentOptions, Context context)"
desc: "Recognizes content/layout data using optical character recognition (OCR).\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.\n\nContent recognition supports auto language identification and multilanguage documents, so only provide a language code if you would like to force the documented to be processed as that specific language in the <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeContentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>.\n\n**Code sample**\n\n```java\nString formPath = \"{file_source_url}\";\n formRecognizerClient.beginRecognizeContentFromUrl(formPath,\n new RecognizeContentOptions()\n .setPollInterval(Duration.ofSeconds(5)), Context.NONE)\n .getFinalResult()\n .forEach(formPage -> {\n System.out.printf(\"Page Angle: %s%n\", formPage.getTextAngle());\n System.out.printf(\"Page Dimension unit: %s%n\", formPage.getUnit());\n // Table information\n System.out.println(\"Recognized Tables: \");\n formPage.getTables()\n .stream()\n .flatMap(formTable -> formTable.getCells().stream())\n .forEach(recognizedTableCell -> System.out.printf(\"%s \", recognizedTableCell.getText()));\n });\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize layout operation until it has completed, has\n failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.FormPage\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FormPage\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormPage?alt=com.azure.ai.formrecognizer.models.FormPage&text=FormPage\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms(java.lang.String,java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms(String modelId, InputStream form, long length)"
name: "beginRecognizeCustomForms(String modelId, InputStream form, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeCustomForms(String modelId, InputStream form, long length)"
summary: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model with or without labels."
parameters:
- description: "The UUID string format custom trained model Id to be used."
name: "modelId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The data of the form to recognize form information from."
name: "form"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomForms(String modelId, InputStream form, long length)"
desc: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model with or without labels.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.\n\n**Code sample**\n\n```java\nFile form = new File(\"{local/file_path/fileName.jpg}\");\n String modelId = \"{custom_trained_model_id}\";\n byte[] fileContent = Files.readAllBytes(form.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n\n formRecognizerClient.beginRecognizeCustomForms(modelId, targetStream, form.length())\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(formFieldMap -> formFieldMap.forEach((fieldText, formField) -> {\n System.out.printf(\"Field text: %s%n\", fieldText);\n System.out.printf(\"Field value data text: %s%n\", formField.getValueData().getText());\n System.out.printf(\"Confidence score: %.2f%n\", formField.getConfidence());\n }));\n }\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize custom form operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms(java.lang.String,java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms(String modelId, InputStream form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
name: "beginRecognizeCustomForms(String modelId, InputStream form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeCustomForms(String modelId, InputStream form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
summary: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model."
parameters:
- description: "The UUID string format custom trained model Id to be used."
name: "modelId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The data of the form to recognize form information from."
name: "form"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable\n <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref> that may be passed when recognizing custom forms."
name: "recognizeCustomFormsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions&text=RecognizeCustomFormsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomForms(String modelId, InputStream form, long length, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
desc: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support.\n\n**Code sample**\n\n```java\nFile form = new File(\"{local/file_path/fileName.jpg}\");\n String modelId = \"{custom_trained_model_id}\";\n boolean includeFieldElements = true;\n byte[] fileContent = Files.readAllBytes(form.toPath());\n\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n formRecognizerClient.beginRecognizeCustomForms(modelId, targetStream, form.length(),\n new RecognizeCustomFormsOptions()\n .setContentType(FormContentType.IMAGE_JPEG)\n .setFieldElementsIncluded(includeFieldElements)\n .setPollInterval(Duration.ofSeconds(10)), Context.NONE)\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(formFieldMap -> formFieldMap.forEach((fieldText, formField) -> {\n System.out.printf(\"Field text: %s%n\", fieldText);\n System.out.printf(\"Field value data text: %s%n\", formField.getValueData().getText());\n System.out.printf(\"Confidence score: %.2f%n\", formField.getConfidence());\n }));\n }\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize custom form operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl(java.lang.String,java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)"
name: "beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)"
summary: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model with or without labels."
parameters:
- description: "The UUID string format custom trained model Id to be used."
name: "modelId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The URL of the form to analyze."
name: "formUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl)"
desc: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model with or without labels.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString formUrl = \"{form_url}\";\n String modelId = \"{custom_trained_model_id}\";\n\n formRecognizerClient.beginRecognizeCustomFormsFromUrl(modelId, formUrl).getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(formFieldMap -> formFieldMap.forEach((fieldText, formField) -> {\n System.out.printf(\"Field text: %s%n\", fieldText);\n System.out.printf(\"Field value data text: %s%n\", formField.getValueData().getText());\n System.out.printf(\"Confidence score: %.2f%n\", formField.getConfidence());\n }));\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize custom form operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl(java.lang.String,java.lang.String,com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
name: "beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
summary: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model."
parameters:
- description: "The UUID string format custom trained model Id to be used."
name: "modelId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The source URL to the input form."
name: "formUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable\n <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref> that may be passed when recognizing custom forms."
name: "recognizeCustomFormsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeCustomFormsOptions&text=RecognizeCustomFormsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeCustomFormsFromUrl(String modelId, String formUrl, RecognizeCustomFormsOptions recognizeCustomFormsOptions, Context context)"
desc: "Recognizes form data from documents using optical character recognition (OCR) and a custom trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString analyzeFilePath = \"{file_source_url}\";\n String modelId = \"{model_id}\";\n boolean includeFieldElements = true;\n\n formRecognizerClient.beginRecognizeCustomFormsFromUrl(modelId, analyzeFilePath,\n new RecognizeCustomFormsOptions()\n .setFieldElementsIncluded(includeFieldElements)\n .setPollInterval(Duration.ofSeconds(10)), Context.NONE)\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(formFieldMap -> formFieldMap.forEach((fieldText, formField) -> {\n System.out.printf(\"Field text: %s%n\", fieldText);\n System.out.printf(\"Field value data text: %s%n\", formField.getValueData().getText());\n System.out.printf(\"Confidence score: %.2f%n\", formField.getConfidence());\n }));\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize custom form operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocuments(java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocuments(InputStream identityDocument, long length)"
name: "beginRecognizeIdentityDocuments(InputStream identityDocument, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeIdentityDocuments(InputStream identityDocument, long length)"
summary: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses."
parameters:
- description: "The data of the identity document to recognize identity document information from."
name: "identityDocument"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocuments(InputStream identityDocument, long length)"
desc: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses. See [here][] for fields found on an identity document.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nFile license = new File(\"local/file_path/license.jpg\");\n ByteArrayInputStream inputStream = new ByteArrayInputStream(Files.readAllBytes(license.toPath()));\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeIdentityDocuments(inputStream, license.length())\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField firstNameField = recognizedFields.get(\"FirstName\");\n if (firstNameField != null) {\n if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {\n String firstName = firstNameField.getValue().asString();\n System.out.printf(\"First Name: %s, confidence: %.2f%n\",\n firstName, firstNameField.getConfidence());\n }\n }\n\n FormField lastNameField = recognizedFields.get(\"LastName\");\n if (lastNameField != null) {\n if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {\n String lastName = lastNameField.getValue().asString();\n System.out.printf(\"Last name: %s, confidence: %.2f%n\",\n lastName, lastNameField.getConfidence());\n }\n }\n\n FormField countryRegionFormField = recognizedFields.get(\"CountryRegion\");\n if (countryRegionFormField != null) {\n if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {\n String countryRegion = countryRegionFormField.getValue().asCountryRegion();\n System.out.printf(\"Country or region: %s, confidence: %.2f%n\",\n countryRegion, countryRegionFormField.getConfidence());\n }\n }\n\n FormField dateOfExpirationField = recognizedFields.get(\"DateOfExpiration\");\n if (dateOfExpirationField != null) {\n if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {\n LocalDate expirationDate = dateOfExpirationField.getValue().asDate();\n System.out.printf(\"Document date of expiration: %s, confidence: %.2f%n\",\n expirationDate, dateOfExpirationField.getConfidence());\n }\n }\n\n FormField documentNumberField = recognizedFields.get(\"DocumentNumber\");\n if (documentNumberField != null) {\n if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {\n String documentNumber = documentNumberField.getValue().asString();\n System.out.printf(\"Document number: %s, confidence: %.2f%n\",\n documentNumber, documentNumberField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/iddocumentfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize identity Document operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocuments(java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocuments(InputStream identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
name: "beginRecognizeIdentityDocuments(InputStream identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeIdentityDocuments(InputStream identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
summary: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses."
parameters:
- description: "The data of the identity document to recognize information from."
name: "identityDocument"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable\n <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref> that may be passed when analyzing an identity document."
name: "recognizeIdentityDocumentOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions?alt=com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions&text=RecognizeIdentityDocumentOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocuments(InputStream identityDocument, long length, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
desc: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses. See [here][] for fields found on an identity document.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nFile licenseDocument = new File(\"local/file_path/license.jpg\");\n boolean includeFieldElements = true;\n // Utility method to convert input stream to Byte buffer\n ByteArrayInputStream inputStream = new ByteArrayInputStream(Files.readAllBytes(licenseDocument.toPath()));\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeIdentityDocuments(inputStream,\n licenseDocument.length(),\n new RecognizeIdentityDocumentOptions()\n .setContentType(FormContentType.IMAGE_JPEG)\n .setFieldElementsIncluded(includeFieldElements),\n Context.NONE)\n .setPollInterval(Duration.ofSeconds(5))\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField firstNameField = recognizedFields.get(\"FirstName\");\n if (firstNameField != null) {\n if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {\n String firstName = firstNameField.getValue().asString();\n System.out.printf(\"First Name: %s, confidence: %.2f%n\",\n firstName, firstNameField.getConfidence());\n }\n }\n\n FormField lastNameField = recognizedFields.get(\"LastName\");\n if (lastNameField != null) {\n if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {\n String lastName = lastNameField.getValue().asString();\n System.out.printf(\"Last name: %s, confidence: %.2f%n\",\n lastName, lastNameField.getConfidence());\n }\n }\n\n FormField countryRegionFormField = recognizedFields.get(\"CountryRegion\");\n if (countryRegionFormField != null) {\n if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {\n String countryRegion = countryRegionFormField.getValue().asCountryRegion();\n System.out.printf(\"Country or region: %s, confidence: %.2f%n\",\n countryRegion, countryRegionFormField.getConfidence());\n }\n }\n\n FormField dateOfBirthField = recognizedFields.get(\"DateOfBirth\");\n if (dateOfBirthField != null) {\n if (FieldValueType.DATE == dateOfBirthField.getValue().getValueType()) {\n LocalDate dateOfBirth = dateOfBirthField.getValue().asDate();\n System.out.printf(\"Date of Birth: %s, confidence: %.2f%n\",\n dateOfBirth, dateOfBirthField.getConfidence());\n }\n }\n\n FormField dateOfExpirationField = recognizedFields.get(\"DateOfExpiration\");\n if (dateOfExpirationField != null) {\n if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {\n LocalDate expirationDate = dateOfExpirationField.getValue().asDate();\n System.out.printf(\"Document date of expiration: %s, confidence: %.2f%n\",\n expirationDate, dateOfExpirationField.getConfidence());\n }\n }\n\n FormField documentNumberField = recognizedFields.get(\"DocumentNumber\");\n if (documentNumberField != null) {\n if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {\n String documentNumber = documentNumberField.getValue().asString();\n System.out.printf(\"Document number: %s, confidence: %.2f%n\",\n documentNumber, documentNumberField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/iddocumentfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize identity document operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)"
name: "beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)"
summary: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses."
parameters:
- description: "The source URL to the input identity document."
name: "identityDocumentUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl)"
desc: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses. See [here][] for fields found on an identity document.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString licenseDocumentUrl = \"licenseDocumentUrl\";\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(licenseDocumentUrl)\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField firstNameField = recognizedFields.get(\"FirstName\");\n if (firstNameField != null) {\n if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {\n String firstName = firstNameField.getValue().asString();\n System.out.printf(\"First Name: %s, confidence: %.2f%n\",\n firstName, firstNameField.getConfidence());\n }\n }\n\n FormField lastNameField = recognizedFields.get(\"LastName\");\n if (lastNameField != null) {\n if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {\n String lastName = lastNameField.getValue().asString();\n System.out.printf(\"Last name: %s, confidence: %.2f%n\",\n lastName, lastNameField.getConfidence());\n }\n }\n\n FormField countryRegionFormField = recognizedFields.get(\"CountryRegion\");\n if (countryRegionFormField != null) {\n if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {\n String countryRegion = countryRegionFormField.getValue().asCountryRegion();\n System.out.printf(\"Country or region: %s, confidence: %.2f%n\",\n countryRegion, countryRegionFormField.getConfidence());\n }\n }\n\n FormField dateOfBirthField = recognizedFields.get(\"DateOfBirth\");\n if (dateOfBirthField != null) {\n if (FieldValueType.DATE == dateOfBirthField.getValue().getValueType()) {\n LocalDate dateOfBirth = dateOfBirthField.getValue().asDate();\n System.out.printf(\"Date of Birth: %s, confidence: %.2f%n\",\n dateOfBirth, dateOfBirthField.getConfidence());\n }\n }\n\n FormField dateOfExpirationField = recognizedFields.get(\"DateOfExpiration\");\n if (dateOfExpirationField != null) {\n if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {\n LocalDate expirationDate = dateOfExpirationField.getValue().asDate();\n System.out.printf(\"Document date of expiration: %s, confidence: %.2f%n\",\n expirationDate, dateOfExpirationField.getConfidence());\n }\n }\n\n FormField documentNumberField = recognizedFields.get(\"DocumentNumber\");\n if (documentNumberField != null) {\n if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {\n String documentNumber = documentNumberField.getValue().asString();\n System.out.printf(\"Document number: %s, confidence: %.2f%n\",\n documentNumber, documentNumberField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/iddocumentfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize identity document operation until it has\n completed, has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(java.lang.String,com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
name: "beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
summary: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses."
parameters:
- description: "The source URL to the input identity Document."
name: "identityDocumentUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable\n <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref> that may be passed when analyzing an identity document."
name: "recognizeIdentityDocumentOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions?alt=com.azure.ai.formrecognizer.models.RecognizeIdentityDocumentOptions&text=RecognizeIdentityDocumentOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeIdentityDocumentsFromUrl(String identityDocumentUrl, RecognizeIdentityDocumentOptions recognizeIdentityDocumentOptions, Context context)"
desc: "Analyze identity documents using optical character recognition (OCR) and a prebuilt model trained on identity documents model to extract key information from passports and US driver licenses. See [here][] for fields found on an identity document.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString licenseDocumentUrl = \"licenseDocumentUrl\";\n boolean includeFieldElements = true;\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeIdentityDocumentsFromUrl(licenseDocumentUrl,\n new RecognizeIdentityDocumentOptions()\n .setFieldElementsIncluded(includeFieldElements),\n Context.NONE).setPollInterval(Duration.ofSeconds(5))\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField firstNameField = recognizedFields.get(\"FirstName\");\n if (firstNameField != null) {\n if (FieldValueType.STRING == firstNameField.getValue().getValueType()) {\n String firstName = firstNameField.getValue().asString();\n System.out.printf(\"First Name: %s, confidence: %.2f%n\",\n firstName, firstNameField.getConfidence());\n }\n }\n\n FormField lastNameField = recognizedFields.get(\"LastName\");\n if (lastNameField != null) {\n if (FieldValueType.STRING == lastNameField.getValue().getValueType()) {\n String lastName = lastNameField.getValue().asString();\n System.out.printf(\"Last name: %s, confidence: %.2f%n\",\n lastName, lastNameField.getConfidence());\n }\n }\n\n FormField countryRegionFormField = recognizedFields.get(\"CountryRegion\");\n if (countryRegionFormField != null) {\n if (FieldValueType.STRING == countryRegionFormField.getValue().getValueType()) {\n String countryRegion = countryRegionFormField.getValue().asCountryRegion();\n System.out.printf(\"Country or region: %s, confidence: %.2f%n\",\n countryRegion, countryRegionFormField.getConfidence());\n }\n }\n\n FormField dateOfExpirationField = recognizedFields.get(\"DateOfExpiration\");\n if (dateOfExpirationField != null) {\n if (FieldValueType.DATE == dateOfExpirationField.getValue().getValueType()) {\n LocalDate expirationDate = dateOfExpirationField.getValue().asDate();\n System.out.printf(\"Document date of expiration: %s, confidence: %.2f%n\",\n expirationDate, dateOfExpirationField.getConfidence());\n }\n }\n\n FormField documentNumberField = recognizedFields.get(\"DocumentNumber\");\n if (documentNumberField != null) {\n if (FieldValueType.STRING == documentNumberField.getValue().getValueType()) {\n String documentNumber = documentNumberField.getValue().asString();\n System.out.printf(\"Document number: %s, confidence: %.2f%n\",\n documentNumber, documentNumberField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/iddocumentfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize identity document operation until it has\n completed, has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoices(java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoices(InputStream invoice, long length)"
name: "beginRecognizeInvoices(InputStream invoice, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeInvoices(InputStream invoice, long length)"
summary: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained invoice model."
parameters:
- description: "The data of the invoice to recognize invoice related information from."
name: "invoice"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoices(InputStream invoice, long length)"
desc: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained invoice model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a invoice.\n\n**Code sample**\n\n```java\nFile invoice = new File(\"local/file_path/invoice.jpg\");\n ByteArrayInputStream inputStream = new ByteArrayInputStream(Files.readAllBytes(invoice.toPath()));\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeInvoices(inputStream, invoice.length())\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField customAddrFormField = recognizedFields.get(\"CustomerAddress\");\n if (customAddrFormField != null) {\n if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {\n System.out.printf(\"Customer Address: %s%n\", customAddrFormField.getValue().asString());\n }\n }\n FormField invoiceDateFormField = recognizedFields.get(\"InvoiceDate\");\n if (invoiceDateFormField != null) {\n if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {\n LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();\n System.out.printf(\"Invoice Date: %s, confidence: %.2f%n\",\n invoiceDate, invoiceDateFormField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/invoicefields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize invoice operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoices(java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoices(InputStream invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
name: "beginRecognizeInvoices(InputStream invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeInvoices(InputStream invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
summary: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained invoice model."
parameters:
- description: "The data of the invoice to recognize invoice related information from."
name: "invoice"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing a invoice."
name: "recognizeInvoicesOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions?alt=com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions&text=RecognizeInvoicesOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoices(InputStream invoice, long length, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
desc: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained invoice model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a invoice.\n\n**Code sample**\n\n```java\nFile invoice = new File(\"local/file_path/invoice.jpg\");\n boolean includeFieldElements = true;\n // Utility method to convert input stream to Byte buffer\n ByteArrayInputStream inputStream = new ByteArrayInputStream(Files.readAllBytes(invoice.toPath()));\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeInvoices(inputStream,\n invoice.length(),\n new RecognizeInvoicesOptions()\n .setContentType(FormContentType.IMAGE_JPEG)\n .setFieldElementsIncluded(includeFieldElements),\n Context.NONE)\n .setPollInterval(Duration.ofSeconds(5))\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField customAddrFormField = recognizedFields.get(\"CustomerAddress\");\n if (customAddrFormField != null) {\n if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {\n System.out.printf(\"Customer Address: %s%n\", customAddrFormField.getValue().asString());\n }\n }\n FormField invoiceDateFormField = recognizedFields.get(\"InvoiceDate\");\n if (invoiceDateFormField != null) {\n if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {\n LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();\n System.out.printf(\"Invoice Date: %s, confidence: %.2f%n\",\n invoiceDate, invoiceDateFormField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/invoicefields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize invoice operation until it has completed, has failed,\n or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoicesFromUrl(java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoicesFromUrl(String invoiceUrl)"
name: "beginRecognizeInvoicesFromUrl(String invoiceUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeInvoicesFromUrl(String invoiceUrl)"
summary: "Recognizes invoice data from document using optical character recognition (OCR) and a prebuilt invoice trained model."
parameters:
- description: "The URL of the invoice document to analyze."
name: "invoiceUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoicesFromUrl(String invoiceUrl)"
desc: "Recognizes invoice data from document using optical character recognition (OCR) and a prebuilt invoice trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on an invoice.\n\n**Code sample**\n\n```java\nString invoiceUrl = \"invoice_url\";\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeInvoicesFromUrl(invoiceUrl)\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField customAddrFormField = recognizedFields.get(\"CustomerAddress\");\n if (customAddrFormField != null) {\n if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {\n System.out.printf(\"Customer Address: %s%n\", customAddrFormField.getValue().asString());\n }\n }\n FormField invoiceDateFormField = recognizedFields.get(\"InvoiceDate\");\n if (invoiceDateFormField != null) {\n if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {\n LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();\n System.out.printf(\"Invoice Date: %s, confidence: %.2f%n\",\n invoiceDate, invoiceDateFormField.getConfidence());\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/invoicefields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize invoice operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoicesFromUrl(java.lang.String,com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
name: "beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
summary: "Recognizes invoice data from documents using optical character recognition (OCR) and a prebuilt invoice trained model."
parameters:
- description: "The source URL to the input invoice document."
name: "invoiceUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing an invoice."
name: "recognizeInvoicesOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions?alt=com.azure.ai.formrecognizer.models.RecognizeInvoicesOptions&text=RecognizeInvoicesOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeInvoicesFromUrl(String invoiceUrl, RecognizeInvoicesOptions recognizeInvoicesOptions, Context context)"
desc: "Recognizes invoice data from documents using optical character recognition (OCR) and a prebuilt invoice trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString invoiceUrl = \"invoice_url\";\n boolean includeFieldElements = true;\n // if training polling operation completed, retrieve the final result.\n formRecognizerClient.beginRecognizeInvoicesFromUrl(invoiceUrl,\n new RecognizeInvoicesOptions()\n .setFieldElementsIncluded(includeFieldElements),\n Context.NONE).setPollInterval(Duration.ofSeconds(5))\n .getFinalResult()\n .stream()\n .map(RecognizedForm::getFields)\n .forEach(recognizedFields -> {\n FormField customAddrFormField = recognizedFields.get(\"CustomerAddress\");\n if (customAddrFormField != null) {\n if (FieldValueType.STRING == customAddrFormField.getValue().getValueType()) {\n System.out.printf(\"Customer Address: %s%n\", customAddrFormField.getValue().asString());\n }\n }\n FormField invoiceDateFormField = recognizedFields.get(\"InvoiceDate\");\n if (invoiceDateFormField != null) {\n if (FieldValueType.DATE == invoiceDateFormField.getValue().getValueType()) {\n LocalDate invoiceDate = invoiceDateFormField.getValue().asDate();\n System.out.printf(\"Invoice Date: %s, confidence: %.2f%n\",\n invoiceDate, invoiceDateFormField.getConfidence());\n }\n }\n });\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize invoice operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts(java.io.InputStream,long)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts(InputStream receipt, long length)"
name: "beginRecognizeReceipts(InputStream receipt, long length)"
nameWithType: "FormRecognizerClient.beginRecognizeReceipts(InputStream receipt, long length)"
summary: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained receipt model."
parameters:
- description: "The data of the receipt to recognize receipt information from."
name: "receipt"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceipts(InputStream receipt, long length)"
desc: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained receipt model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a receipt.\n\n**Code sample**\n\n```java\nFile receipt = new File(\"{receipt_url}\");\n byte[] fileContent = Files.readAllBytes(receipt.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n\n formRecognizerClient.beginRecognizeReceipts(targetStream, receipt.length()).getFinalResult()\n .forEach(recognizedReceipt -> {\n Map<String, FormField> recognizedFields = recognizedReceipt.getFields();\n FormField merchantNameField = recognizedFields.get(\"MerchantName\");\n if (merchantNameField != null) {\n if (FieldValueType.STRING == merchantNameField.getValue().getValueType()) {\n String merchantName = merchantNameField.getValue().asString();\n System.out.printf(\"Merchant Name: %s, confidence: %.2f%n\",\n merchantName, merchantNameField.getConfidence());\n }\n }\n\n FormField merchantPhoneNumberField = recognizedFields.get(\"MerchantPhoneNumber\");\n if (merchantPhoneNumberField != null) {\n if (FieldValueType.PHONE_NUMBER == merchantPhoneNumberField.getValue().getValueType()) {\n String merchantAddress = merchantPhoneNumberField.getValue().asPhoneNumber();\n System.out.printf(\"Merchant Phone number: %s, confidence: %.2f%n\",\n merchantAddress, merchantPhoneNumberField.getConfidence());\n }\n }\n\n FormField transactionDateField = recognizedFields.get(\"TransactionDate\");\n if (transactionDateField != null) {\n if (FieldValueType.DATE == transactionDateField.getValue().getValueType()) {\n LocalDate transactionDate = transactionDateField.getValue().asDate();\n System.out.printf(\"Transaction Date: %s, confidence: %.2f%n\",\n transactionDate, transactionDateField.getConfidence());\n }\n }\n\n FormField receiptItemsField = recognizedFields.get(\"Items\");\n if (receiptItemsField != null) {\n System.out.printf(\"Receipt Items: %n\");\n if (FieldValueType.LIST == receiptItemsField.getValue().getValueType()) {\n List<FormField> receiptItems = receiptItemsField.getValue().asList();\n receiptItems.stream()\n .filter(receiptItem -> FieldValueType.MAP == receiptItem.getValue().getValueType())\n .map(formField -> formField.getValue().asMap())\n .forEach(formFieldMap -> formFieldMap.forEach((key, formField) -> {\n if (\"Quantity\".equals(key)) {\n if (FieldValueType.FLOAT == formField.getValue().getValueType()) {\n Float quantity = formField.getValue().asFloat();\n System.out.printf(\"Quantity: %f, confidence: %.2f%n\",\n quantity, formField.getConfidence());\n }\n }\n }));\n }\n }\n });\n }\n```\n\n\n[here]: https://aka.ms/formrecognizer/receiptfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize receipt operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts(java.io.InputStream,long,com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts(InputStream receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
name: "beginRecognizeReceipts(InputStream receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeReceipts(InputStream receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
summary: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained receipt model."
parameters:
- description: "The data of the receipt to recognize receipt information from."
name: "receipt"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>"
- description: "The exact length of the data."
name: "length"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing a receipt."
name: "recognizeReceiptsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions&text=RecognizeReceiptsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceipts(InputStream receipt, long length, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
desc: "Recognizes data from the provided document data using optical character recognition (OCR) and a prebuilt trained receipt model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a receipt.\n\n**Code sample**\n\n```java\nFile receipt = new File(\"{local/file_path/fileName.jpg}\");\n boolean includeFieldElements = true;\n byte[] fileContent = Files.readAllBytes(receipt.toPath());\n try (InputStream targetStream = new ByteArrayInputStream(fileContent)) {\n for (RecognizedForm recognizedForm : formRecognizerClient\n .beginRecognizeReceipts(targetStream, receipt.length(),\n new RecognizeReceiptsOptions()\n .setContentType(FormContentType.IMAGE_JPEG)\n .setFieldElementsIncluded(includeFieldElements)\n .setLocale(FormRecognizerLocale.EN_US)\n .setPollInterval(Duration.ofSeconds(5)), Context.NONE)\n .getFinalResult()) {\n Map<String, FormField> recognizedFields = recognizedForm.getFields();\n FormField merchantNameField = recognizedFields.get(\"MerchantName\");\n if (merchantNameField != null) {\n if (FieldValueType.STRING == merchantNameField.getValue().getValueType()) {\n String merchantName = merchantNameField.getValue().asString();\n System.out.printf(\"Merchant Name: %s, confidence: %.2f%n\",\n merchantName, merchantNameField.getConfidence());\n }\n }\n FormField merchantPhoneNumberField = recognizedFields.get(\"MerchantPhoneNumber\");\n if (merchantPhoneNumberField != null) {\n if (FieldValueType.PHONE_NUMBER == merchantPhoneNumberField.getValue().getValueType()) {\n String merchantAddress = merchantPhoneNumberField.getValue().asPhoneNumber();\n System.out.printf(\"Merchant Phone number: %s, confidence: %.2f%n\",\n merchantAddress, merchantPhoneNumberField.getConfidence());\n }\n }\n FormField transactionDateField = recognizedFields.get(\"TransactionDate\");\n if (transactionDateField != null) {\n if (FieldValueType.DATE == transactionDateField.getValue().getValueType()) {\n LocalDate transactionDate = transactionDateField.getValue().asDate();\n System.out.printf(\"Transaction Date: %s, confidence: %.2f%n\",\n transactionDate, transactionDateField.getConfidence());\n }\n }\n FormField receiptItemsField = recognizedFields.get(\"Items\");\n if (receiptItemsField != null) {\n System.out.printf(\"Receipt Items: %n\");\n if (FieldValueType.LIST == receiptItemsField.getValue().getValueType()) {\n List<FormField> receiptItems = receiptItemsField.getValue().asList();\n receiptItems.stream()\n .filter(receiptItem -> FieldValueType.MAP == receiptItem.getValue().getValueType())\n .map(formField -> formField.getValue().asMap())\n .forEach(formFieldMap -> formFieldMap.forEach((key, formField) -> {\n if (\"Quantity\".equals(key)) {\n if (FieldValueType.FLOAT == formField.getValue().getValueType()) {\n Float quantity = formField.getValue().asFloat();\n System.out.printf(\"Quantity: %f, confidence: %.2f%n\",\n quantity, formField.getConfidence());\n }\n }\n }));\n }\n }\n }\n }\n```\n\n\n[here]: https://aka.ms/formrecognizer/receiptfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> that polls the recognize receipt operation until it has completed, has failed,\n or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl(java.lang.String)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl(String receiptUrl)"
name: "beginRecognizeReceiptsFromUrl(String receiptUrl)"
nameWithType: "FormRecognizerClient.beginRecognizeReceiptsFromUrl(String receiptUrl)"
summary: "Recognizes receipt data from document using optical character recognition (OCR) and a prebuilt receipt trained model."
parameters:
- description: "The URL of the receipt to analyze."
name: "receiptUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceiptsFromUrl(String receiptUrl)"
desc: "Recognizes receipt data from document using optical character recognition (OCR) and a prebuilt receipt trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\nSee [here][] for fields found on a receipt.\n\n**Code sample**\n\n```java\nString receiptUrl = \"{file_source_url}\";\n formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl)\n .getFinalResult()\n .forEach(recognizedReceipt -> {\n Map<String, FormField> recognizedFields = recognizedReceipt.getFields();\n FormField merchantNameField = recognizedFields.get(\"MerchantName\");\n if (merchantNameField != null) {\n if (FieldValueType.STRING == merchantNameField.getValue().getValueType()) {\n String merchantName = merchantNameField.getValue().asString();\n System.out.printf(\"Merchant Name: %s, confidence: %.2f%n\",\n merchantName, merchantNameField.getConfidence());\n }\n }\n\n FormField merchantPhoneNumberField = recognizedFields.get(\"MerchantPhoneNumber\");\n if (merchantPhoneNumberField != null) {\n if (FieldValueType.PHONE_NUMBER == merchantPhoneNumberField.getValue().getValueType()) {\n String merchantAddress = merchantPhoneNumberField.getValue().asPhoneNumber();\n System.out.printf(\"Merchant Phone number: %s, confidence: %.2f%n\",\n merchantAddress, merchantPhoneNumberField.getConfidence());\n }\n }\n\n FormField transactionDateField = recognizedFields.get(\"TransactionDate\");\n if (transactionDateField != null) {\n if (FieldValueType.DATE == transactionDateField.getValue().getValueType()) {\n LocalDate transactionDate = transactionDateField.getValue().asDate();\n System.out.printf(\"Transaction Date: %s, confidence: %.2f%n\",\n transactionDate, transactionDateField.getConfidence());\n }\n }\n\n FormField receiptItemsField = recognizedFields.get(\"Items\");\n if (receiptItemsField != null) {\n System.out.printf(\"Receipt Items: %n\");\n if (FieldValueType.LIST == receiptItemsField.getValue().getValueType()) {\n List<FormField> receiptItems = receiptItemsField.getValue().asList();\n receiptItems.stream()\n .filter(receiptItem -> FieldValueType.MAP == receiptItem.getValue().getValueType())\n .map(formField -> formField.getValue().asMap())\n .forEach(formFieldMap -> formFieldMap.forEach((key, formField) -> {\n if (\"Quantity\".equals(key)) {\n if (FieldValueType.FLOAT == formField.getValue().getValueType()) {\n Float quantity = formField.getValue().asFloat();\n System.out.printf(\"Quantity: %f, confidence: %.2f%n\",\n quantity, formField.getConfidence());\n }\n }\n }));\n }\n }\n });\n```\n\n\n[here]: https://aka.ms/formrecognizer/receiptfields"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize receipt operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl(java.lang.String,com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions,com.azure.core.util.Context)"
fullName: "com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
name: "beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
nameWithType: "FormRecognizerClient.beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
summary: "Recognizes receipt data from documents using optical character recognition (OCR) and a prebuilt receipt trained model."
parameters:
- description: "The source URL to the input receipt."
name: "receiptUrl"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The additional configurable <xref uid=\"com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"options\"></xref>\n that may be passed when analyzing a receipt."
name: "recognizeReceiptsOptions"
type: "<xref href=\"com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions?alt=com.azure.ai.formrecognizer.models.RecognizeReceiptsOptions&text=RecognizeReceiptsOptions\" data-throw-if-not-resolved=\"False\" />"
- description: "Additional context that is passed through the HTTP pipeline during the service call."
name: "context"
type: "<xref href=\"com.azure.core.util.Context?alt=com.azure.core.util.Context&text=Context\" data-throw-if-not-resolved=\"False\" />"
syntax: "public SyncPoller<FormRecognizerOperationResult,List<RecognizedForm>> beginRecognizeReceiptsFromUrl(String receiptUrl, RecognizeReceiptsOptions recognizeReceiptsOptions, Context context)"
desc: "Recognizes receipt data from documents using optical character recognition (OCR) and a prebuilt receipt trained model.\n\nThe service does not support cancellation of the long running operation and returns with an error message indicating absence of cancellation support\n\n**Code sample**\n\n```java\nString receiptUrl = \"{receipt_url}\";\n formRecognizerClient.beginRecognizeReceiptsFromUrl(receiptUrl,\n new RecognizeReceiptsOptions()\n .setLocale(FormRecognizerLocale.EN_US)\n .setPollInterval(Duration.ofSeconds(5))\n .setFieldElementsIncluded(true), Context.NONE)\n .getFinalResult()\n .forEach(recognizedReceipt -> {\n Map<String, FormField> recognizedFields = recognizedReceipt.getFields();\n FormField merchantNameField = recognizedFields.get(\"MerchantName\");\n if (merchantNameField != null) {\n if (FieldValueType.STRING == merchantNameField.getValue().getValueType()) {\n String merchantName = merchantNameField.getValue().asString();\n System.out.printf(\"Merchant Name: %s, confidence: %.2f%n\",\n merchantName, merchantNameField.getConfidence());\n }\n }\n\n FormField merchantPhoneNumberField = recognizedFields.get(\"MerchantPhoneNumber\");\n if (merchantPhoneNumberField != null) {\n if (FieldValueType.PHONE_NUMBER == merchantPhoneNumberField.getValue().getValueType()) {\n String merchantAddress = merchantPhoneNumberField.getValue().asPhoneNumber();\n System.out.printf(\"Merchant Phone number: %s, confidence: %.2f%n\",\n merchantAddress, merchantPhoneNumberField.getConfidence());\n }\n }\n\n FormField transactionDateField = recognizedFields.get(\"TransactionDate\");\n if (transactionDateField != null) {\n if (FieldValueType.DATE == transactionDateField.getValue().getValueType()) {\n LocalDate transactionDate = transactionDateField.getValue().asDate();\n System.out.printf(\"Transaction Date: %s, confidence: %.2f%n\",\n transactionDate, transactionDateField.getConfidence());\n }\n }\n\n FormField receiptItemsField = recognizedFields.get(\"Items\");\n if (receiptItemsField != null) {\n System.out.printf(\"Receipt Items: %n\");\n if (FieldValueType.LIST == receiptItemsField.getValue().getValueType()) {\n List<FormField> receiptItems = receiptItemsField.getValue().asList();\n receiptItems.stream()\n .filter(receiptItem -> FieldValueType.MAP == receiptItem.getValue().getValueType())\n .map(formField -> formField.getValue().asMap())\n .forEach(formFieldMap -> formFieldMap.forEach((key, formField) -> {\n if (\"Quantity\".equals(key)) {\n if (FieldValueType.FLOAT == formField.getValue().getValueType()) {\n Float quantity = formField.getValue().asFloat();\n System.out.printf(\"Quantity: %f, confidence: %.2f%n\",\n quantity, formField.getConfidence());\n }\n }\n }));\n }\n }\n });\n```"
returns:
description: "A <xref uid=\"com.azure.core.util.polling.SyncPoller\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SyncPoller\"></xref> to poll the progress of the recognize receipt operation until it has completed,\n has failed, or has been cancelled. The completed operation returns a list of <xref uid=\"com.azure.ai.formrecognizer.models.RecognizedForm\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RecognizedForm\"></xref>."
type: "<xref href=\"com.azure.core.util.polling.SyncPoller?alt=com.azure.core.util.polling.SyncPoller&text=SyncPoller\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.ai.formrecognizer.models.FormRecognizerOperationResult?alt=com.azure.ai.formrecognizer.models.FormRecognizerOperationResult&text=FormRecognizerOperationResult\" data-throw-if-not-resolved=\"False\" />,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<xref href=\"com.azure.ai.formrecognizer.models.RecognizedForm?alt=com.azure.ai.formrecognizer.models.RecognizedForm&text=RecognizedForm\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
type: "class"
desc: "This class provides an synchronous client to connect to the Form Recognizer Azure Cognitive Service.\n\nThis client provides synchronous methods to perform:\n\n1. Custom Form Analysis: Extraction and analysis of data from forms and documents specific to distinct business data and use cases. Use the custom trained model by passing its modelId into the <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeCustomForms*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"beginRecognizeCustomForms\"></xref> method.\n2. Prebuilt Model Analysis: Analyze receipts, business cards, invoices and other documents with [supported prebuilt models][] Use the <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeReceipts*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"beginRecognizeReceipts\"></xref> method to recognize receipt information.\n3. Layout Analysis: Extraction and analysis of text, selection marks, tables, and bounding box coordinates, from forms and documents. Use <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerClient.beginRecognizeContent(java.io.InputStream,long)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"beginRecognizeContent\"></xref> method tpo perform layout analysis.\n4. Polling and Callbacks: It includes mechanisms for polling the service to check the status of an analysis operation or registering callbacks to receive notifications when the analysis is complete.\n\n**Refer to the [Migration guide][] to use API versions 2022-08-31 and up.**\n\nService clients are the point of interaction for developers to use Azure Form Recognizer. <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.ai.formrecognizer.FormRecognizerClient\"></xref> is the synchronous service client and <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.ai.formrecognizer.FormRecognizerAsyncClient\"></xref> is the asynchronous service client. The examples shown in this document use a credential object named DefaultAzureCredential for authentication, which is appropriate for most scenarios, including local development and production environments. Additionally, we recommend using [managed identity][] for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the [Azure Identity documentation\"][Azure Identity documentation].\n\n**Sample: Construct a FormRecognizerClient with DefaultAzureCredential**\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.ai.formrecognizer.FormRecognizerClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.ai.formrecognizer.FormRecognizerClient\"></xref>, using the \\`DefaultAzureCredentialBuilder\\` to configure it.\n\n```java\nFormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder()\n .endpoint(\"{endpoint}\")\n .credential(new DefaultAzureCredentialBuilder().build())\n .buildClient();\n```\n\nFurther, see the code sample below to use <xref uid=\"com.azure.core.credential.AzureKeyCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AzureKeyCredential\"></xref> for client creation.\n\n```java\nFormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder()\n .credential(new AzureKeyCredential(\"{key}\"))\n .endpoint(\"{endpoint}\")\n .buildClient();\n```\n\n\n[supported prebuilt models]: https://aka.ms/form-recognizer-service-2.1.0\n[Migration guide]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/migration-guide.md\n[managed identity]: https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/\n[Azure Identity documentation]: https://learn.microsoft.com/java/api/overview/azure/identity-readme"
metadata: {}
package: "com.azure.ai.formrecognizer"
artifact: com.azure:azure-ai-formrecognizer:4.1.10