1. Component introduction
Prerequisites: None
Recommended next component: Conditional Branch. Use branch conditions to check whether the OCR call is successful and design the subsequent flow.
This component extracts structured information from documents using Optical Character Recognition (OCR) (example).
2. Inputs
For details about each input, see the help information on the component panel in the application flow editor.
3. Outputs
For details about each output, see the help information on the component panel in the application flow editor.
3.1. Key API return results
This output returns a dictionary that contains the key recognition results from the API call. The following table describes the key-value pairs in the dictionary.
Key |
Key terms |
Value data type |
content |
A collection of the text blocks recognized from the image. |
String |
3.2. Error message
This output returns a string that contains the error code and error message. For more information, see the OCR Error Center.
https://next.api.aliyun.com/document/ocr-api/2021-07-07/errorCode
4. Component usage example
4.1. Component configuration example
Set AI engine to Alibaba Cloud OCR.
For Image file path to recognize, enter the file path of the image that you want to recognize. This example uses the following image:

Keep the default values for the advanced options.
4.2. Example execution result
5. Flow example
5.1. Build the flow
Use the OCR document structure recognition component to select the image file path.
Use the Conditional Branch component to check if the OCR call is successful. Set the branch condition so that `v_documents_tructure_success_1` is equal to the Boolean value `True`.
In the success branch, use the Get Value of a Specified Key component to retrieve the value of the `content` key from the `v_documents_tructure_data_1` dictionary.
Use the Record Log component to print the recognition result.
In the failure branch, use the Record Log component to print the error message.

5.2. Execution result
As shown in the following figure, after the OCR call is successful, the recognition result is printed in the log panel.