Extract Content from an Invoice PDF Document with a Document Understanding Action

You can use AI to extract information from invoices, receipts, passports, and drivers licenses with a document understanding action. This section provides a high-level use case on how to exact information from an invoice in PDF format and convert it to JSON format in Oracle Integration.

Ensure that you have completed all prerequisites for using the document understanding action. See Extract Document Information with a Document Understanding Action.

  1. Create an application integration.
  2. Drag a REST Adapter into the integration canvas.
  3. Configure the REST Adapter.
    1. On the Basic Info page, enter a name.
    2. On the Resource Configuration page, specify the necessary information. For example:
      • Enter a relative resource URL: /process.
      • Select the POST action.
      • Select Configure a request payload for this endpoint.
    3. On the Configure Request page, select Binary as the request payload format.
    4. Complete the wizard.
  4. Click Actions Integration actions icon and drag the Document Understanding action into the integration canvas.
  5. Enter the following information in the wizard.
    1. Enter a name and optional description.
    2. From the Compartment Name list, select the compartment in which your instance is running.
    3. From the Document Type list, select Invoice.
  6. Open the mapper. The invoice PDF document must be sent in base-64 format.
  7. Expand the target Document element.
  8. Right-click Data, and select Create target node.
  9. In the target section, click Functions Mapper functions icon.
  10. In the Expression Builder, click Design View Switch view icon.
  11. In the Functions section, expand Advanced, and drag encodeReferenceToBase64 into the Expression Builder. This step is required for extracting data from all supported document types (invoice, receipt, drivers license, and passport).
  12. Map Stream Reference from the Sources section to the encodeReferenceToBase64 () function in the Expression Builder.


    The mapper shows the Sources, Mapping canvas, and Targets section. The target Functions list is shown. The encodeReferenceToBase64 function is selected. The encodeReferenceToBase64 function is shown in the Expression Builder at the bottom. The source Stream Reference has been dragged into the function.

  13. Return to the integration canvas. This action validates your expression.
  14. Assign a business identifier.


    The Business identifiers section is shown. On the left side, the Input sources tree is expanded to show http.request.method selected. That parameter has been dragged to the Primary business identifiers field.

  15. Save and activate the integration.
  16. From the Actions Actions icon menu, select Run.
  17. In the Body tab of the Request section, click File, then Browse.
  18. Upload the PDF file of your invoice.
  19. Click Run.
  20. When processing completes, expand the invoke connection in the activity stream.
  21. Scroll through the payload and note that the fields from the invoice PDF document have been converted to JSON format.


    The activity stream is shown. The invoke ProcessDocument is expanded to show the fields of the PDF in JSON format. For this example, amountDue, billingAddress, billingAddressRecipient, customerAddress, customerAddressRecipient, customerId, customerName, customerTaxId, dueDate, and invoiceDate are shown.

    A log action was not added to this integration. However, adding one to the end of the integration also enables you to see the fields that are returned as output by the Document Understanding API. An invoice returns the following specific fields. The fields returned are different and visible in the log action for each document type that you select in the wizard (receipt, drivers license, or passport). See Analyzing with the API.


    The Configure logger panel is shown. In the Log list, Always is selected. On the left, the Input sources tab is shown. AnalyzeDocumentActionResponse is expanded to show the fields named amountDue, billingAddress, billingAddressRecipient, customerAddress, customerAddressRecipient, customerId, customerName, and customerTaxId.