Define regions to text

  • Last Post 14 August 2018
  • Topic Is Solved
Roopa Kutikuppala posted this 07 August 2018


I am using cloud ocr sdk API to retrieve one or more text fields information from pdf page,but i am finding difficulty to set regions on document to retrieve desired text fields information.Can you please suggest how to set regions to retrieve multiple fields inforamtion

Order By: Standard | Newest | Votes
Helen Osetrova posted this 10 August 2018




If you are processing well-structured documents with fixed layout (i.e. positions of fields do not change from one document to another), it is better practice to use the processFields method. The method starts the processing task with the parameters of processing described in a special XML file. This XML file should be transmitted in the request body. You can use the XSD schema of the XML file to create the file with necessary settings. Please see also the description of the tags and several examples of XML files with settings in XML Parameters of Field Recognition.


Please note that using the processFields method you should specify coordinates of each field should be processed. Pay your attention that the coordinates of each field should be specified relative to the left top corner of the image in the following order: left, top, right, bottom. It means the following:


left – x coordinate of the top pixel of the field,

top - y coordinate of the top pixel of the field,

right - x coordinate of the bottom pixel of the field,

bottom - y coordinate of the bottom pixel of the field.


The left, top, right and bottom coordinates are rectangle border locations in pixel. For example, on the picture below the coordinate of top left corner of the image block is (20, 143), which means that the left coordinate of the image is 20, the top coordinate is 143.


On the other hand, if your documents have flexible layout (coordinates of fields may differ in different documents), you may try to export the source document to the XML format with the help of the processImage method. Then you could parse the output XML on your side and extract the coordinates of each block for further processing. Please see the Output XML Document article for the detailed description of the XML output.


You can find some our standard code samples demonstrating implementation of some general scenarios on the Code Samples web page.


Hope this information will be helpful!


Roopa Kutikuppala posted this 13 August 2018

Hi Helen,

Thanks for your response,It means we have to calculate regions of a page by imaging top,left,bottom,right fields for all fields in a document. Is it correct? or any other calculation is there to calculate regions.

Helen Osetrova posted this 13 August 2018

Hi Roopa,


You understand everything correctly. The automatic layout analysis is not available for field-level recognition, i.e. the processing methods are intended for manually imposition of the blocks.

The left, top, right, and bottom borders of each field should be calculated and explicitly specified in the processFields method. 


Roopa Kutikuppala posted this 14 August 2018

Hi Helen,