Skip to main content
Roberty Studio
RPAAPIs

AWS

AWS

The AWS module is responsible for actions that integrate the Amazon Web Service tool.

Methods​

Textract​

Method responsible for recognizing and getting the characters in an image passed by the user using the Textract tool of Amazon Web Service. For example: if the image passed by the user contains the word "Roberty", this action tries to recognize it character by character and return them.

js
const textract = await API.AWS.textract["v2_0_0"]({
filePath: `C:\\Roberty\\document.pdf`,
featureType: ["FORMS", "TABLES", "QUERIES"],
queries: [`Qual a data de vencimento?`],
pageRanges: `1-3`,
credentials: {
accessKeyId: `asd`,
secretAccessKey: `dsa`,
},
region: `us-east-1`,
bucket: `qwe`,
timeout: 120,
});

Required parameters​

  • filePath: String - expects a string indicating the path where the file (image or PDF) is saved. PDF files are converted into images, one per page, before the analysis.
  • featureType: String[] - expects an array of strings with the desired analysis types: FORMS, TABLES and/or QUERIES. If an empty array ([]) is passed, only text detection (words and lines) is performed.

Optional parameters​

  • queries: String[] - if the value QUERIES is passed in featureType, expects an array of strings with the questions that must be answered by the document analysis.
  • pageRanges: String - expects the PDF pages to be analyzed, separated by commas and/or as ranges (e.g. 1-3, 5). If it is not passed, every page is analyzed.
  • credentials: Object - expects an object containing accessKeyId: String and secretAccessKey: String, with the AWS credentials to be used.
  • region: String - expects the AWS region to be used. If it is not passed, the default value is us-east-1.
  • bucket: String - expects the name of the Bucket created in S3 to store the files temporarily. Recommended for large files.
  • timeout: Number - expects a value in seconds indicating the maximum waiting time for the analysis. If it is not passed, the default value is 120 seconds.

Return​

The constant or variable created, such as the textract of the example shown earlier, receives an object that gives access to the following properties:

  • textract.content: String - Returns all the text found, with lines separated by line breaks.
  • textract.words: Array - Returns every word found by the analysis.
  • textract.lines: Array - Returns every line of words found by the analysis.
  • textract.forms: Array - Returns the information obtained during the analysis as information forms.
  • textract.tables: Array - Returns the tables found during the analysis.
  • textract.queries: Array - Returns the questions and answers asked and obtained by the user and the analysis.