Recognize quota invoices with OCR

Updated at:

1. Component overview

Note

Required preceding component: None

Recommended subsequent component: Conditional Branch. You can use a conditional branch to check whether the OCR call is successful and then design the subsequent flow.

Use this component to recognize key fields on quota invoices, such as the invoice code, number, and amount, using Optical Character Recognition (OCR) technology. For an example, see Quota invoices.

2. Inputs

Note

For more information about each input, see the help text for the component in the application flow editor.

3. Outputs

Note

For more information about each output, see the help text for the component 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. The following table describes the key-value pairs in the dictionary.

Key

Key concepts

Data type

invoiceCode

Invoice code

String

invoiceNumber

Invoice number

String

AmountInWords

Amount in words

String

Amount

Amount in numbers

String

title

Invoice title

String

formType

Copy

String

3.2. Error message

The output is a string containing the error code and the 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

  1. For AI engine, select Alibaba Cloud OCR.

  2. For Path of the image file to recognize, enter the path of the image file. This example uses the following image.

    image

  3. Keep the default values for the advanced options.

4.2. Example execution result

5. Flow example

5.1. Build the flow

  1. Use the Recognize Quota Invoice with OCR component and select the path of the image file to recognize.

  2. Use the Conditional Branch component to check whether the OCR call is successful. Set the branch condition so that v_recognize_quotainvoice_success_1 is equal to the Boolean value True.

  3. In the success branch, use the Get Value of Specified Key component to retrieve the value of a specified key from the dictionary of key API return results. This example uses the title key (invoice title).

  4. Use the Record Log component to print the key recognition result.

  5. In the failure branch, use the Record Log component to print the error message.image

5.2. Execution result

As shown in the following figure, after the OCR call succeeds, the recognition result is printed to the log panel.