Skip to main content

Azure OCR

Description

This step is used for OCR using Azure on pdf and image files.

Prerequisites:
a. To use Azure OCR service, first create resource of Document intelligence Service. Reference link - https://portal.azure.com/#home
b. Get key and endpoint from Resource Management section.

Notes:

  1. Users must have active Document Intelligence service resource.
  2. Api End Point and key found in resource management section:

For example.
a. key and endpoint –

AzureOCR
  1. When a user submits a request, the Azure service waits for a period to process it. If the processing is not completed within this time, it attempts three times with some delay before completion. If the processing is still not completed after these three attempts, it raises an appropriate exception.
  2. Supported API versions for the DocEdge Azure OCR plugin are 2024-11-30 and 2023-07-31. Following is the supported feature list:
AzureOCR

Example:
In the following example, the 'inputFile' parameter contains the file path, specifying 'page 1' for extraction from a multipage file. 'en' is used as the locale, and barcodes are decoded if present in the document. Please provide the API Endpoint and Key created on the Azure portal. Here, a prebuilt-read model is utilized for text extraction.

AzureOCR

Error Codes
Response –

{
"error": {
"code": "401",
"message": "Access denied due to invalid subscription key or wrong API endpoint.
Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."
}
}

Solution – Need to provide working key and endpoint
Invalid Modeld: Response -

{
"error": {
"code": "NotFound",
"message": "Resource not found.",
"innererror": {
"code": "ModelNotFound",
"message": "The requested model was not found."
}
}
}

Solution – Need to provide correct prebuild model name or custom model name For more codes refere below link – https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/v3-error-guide?view=doc-intel-4.0.0

Reference Links:
API – Azure POST Request
https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/analyze-document?view=rest-aiservices-v4.0%20(2024-11-30)&viewFallbackFrom=rest-aiservices-2023-07-31&preserve-view=true&tabs=HTTP#contentformat

API – Azure GET Request
https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/get-analyze-result?view=rest-aiservices-v4.0%20(2024-11-30)&tabs=HTTP

Azure Document Intelligence Service
https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/?view=doc-intel-4.0.0

Configurations

No.Field NameDescription
1Step NameName of the step. This name must be unique in a single workflow.
The field is mandatory.
Input tab
1Input File PathInput file path.
The field is mandatory.
2Pages (Ex 1..2,4)List of 1-based page numbers to analyze. Ex. "1-3,5,7-9"
The field is mandatory.
3LocaleLocale hint for text recognition and document analysis. Value may contain only the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Keep field Blank to recognize all langugaes.
The field is mandatory.
4FeaturesProvide features such as barcodes to decode barcode, QR code from input file. Provide keyValuePairs to get ocr in the form of key value pairs if using model-id as prebuild-layout or prevuild-document.
The field is mandatory.
Connection tab
1API EndPointSupported Azure Cognitive Services endpoints.
The field is mandatory.
2KeySpecify Azure Document Intelligence service key.
If the checkbox Accept Value as variable/static is selected, then the password field appears as a text box and accepts static or variable values.
OR
If the checkbox Accept Value as variable/static is not selected, then the password field appears as a dropdown in which you can select a field from the previous steps.
The field is mandatory.
3API VersionAzure API version.
Supported versions are V4(2024-11-30) and V3.1(2023-07-31).
Default value- 2024-11-30
4Retry CountRetry Count for Azure API.
Default value- 6
The field is mandatory.
5Retry Delay In SecondsAzure API Retry Delay.
Default value- 2
The field is mandatory.
6ModelIdType of model to be used for OCR.
Reference link - https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/overview?view=doc-intel-4.0.0
The field is mandatory.
Output tab
1JSON Output VarOutput field to hold the Json result of the successful plugin execution.
Default value: JSONResult
2Text Output VarOutput field to hold the text result of the successful plugin execution.
Default value: OCRTextResult