Extract Text from Regions

Overview

The 'Extract Text Regions' flow action enables text to be extracted from specified regions of a PDF document and returns an array of the extracted text. 

Whilst this action is limited to extracting text regions from PDF documents, simply convert files to PDF format using the 'Convert to PDF' flow action prior to executing this action to enable text regions to be extracted from 70+ different files types.

Please refer to the Supported Document Types articles for a complete list of the different file formats / document types which are supported for PDF conversion.

Parameters

The default 'Extract Text from Regions' flow action parameters are detailed below:

  • Text Regions: An array of Text Regions (See below for further details)
  • Filename: The PDF filename (including file extension)
  • File Content: (Optional) A Base64 encoded representation of the PDF file to be processed.
  • Operation ID: (Optional) The ID of a parent operation, please refer to: Flow Action Return Options: File Content vs. Operation ID

1.jpg

Please refer to the Obtaining the 'File Contents' Parameter article for guidance on how to obtain the 'File Content' parameter ready to provide to an Encodian flow action. 

Text Regions

A text region is specified as a rectangle and is made up of 4 coordinates representing the bottom left of the rectangle on the X and Y axis and the upper right of the rectangle on the X and Y axis.

The origin (0,0) of the coordinate system is the bottom left hand corner of the page.  Coordinates are specified in points, a typical A4 page is 595 x 842 points.

3.png

  • Text Region - Multiple text regions can be selected in one operation.  To create more than one region click the "Add new item" button:
    • Text Regions Name: Provide a name with which to reference the extracted region
    • Text Regions Lower Left X Coordinate: Number of points across from the left hand edge of the page to the lower left corner of the rectangle
    • Text Regions Lower Left Y Coordinate: Number of points up from the bottom edge of the page to the lower left corner of the rectangle
    • Text Regions Upper Right X Coordinate: Number of points across from the left hand edge of the page to the upper right corner of the rectangle
    • Text Regions Upper Right Y Coordinate: Number of points up from the bottom edge of the page to the upper right corner of the rectangle.

Advanced Parameters

The advanced 'Extract Text from Regions' flow action parameters are detailed below:

2..jpg

  • Final Operation: Sets whether the this is last Encodian flow action.

Please refer to the Flow Action Return Options: File Content vs. Operation ID article for further details on the 'Final Operation' parameter.

Return Parameters

The 'Extract Text Regions' flow action returns the following data.

Action Specific Values

  • Text Region Results - An array of results for each text region specified

An partial example return payload (JSON) is detailed below:

 "TextRegionResults": [
{
"Name": "Extracted Region Name",
"Text": "This is text extracted from the demo region",
"PageNumber": 1
}
]

To obtain a value from the 'Text Region Results' array a standard Filter Array Flow action can be used:

4.png

Standard Return Values

  • Filename - The filename of the document.
  • FileContent - The processed document content.
  • OperationId - The unique ID assigned to this operation.
  • HttpStatusCode - The HTTP Status code for the response.
  • HttpStatusMessage - The HTTP Status message for the response.
  • Errors - An array of error messages should an error occur.
  • Operation Status - Indicates whether the operation has completed, has been queued or has failed.

A complete example return payload (JSON) is detailed below:

{
"TextRegionResults": [
{
"Name": "Extracted Region Name",
"Text": "This is text extracted from the demo region",
"PageNumber": 4
}
],
"HttpStatusCode": 200,
"HttpStatusMessage": "",
"OperationId": "**********-****-****-****-************",
"Errors": [],
"Operation Status": "Complete",
"Filename": "textRegionsDemo.pdf",
"FileContent": null
}

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk