CreateVirtualZone

Creates a field zone at runtime based on the identified text locations.

Member of namespace

Locate

Syntax

bool CreateVirtualZone (string  sFieldName)

Parameters

sFieldName
Type: String
Name of the field that has its zone assigned based on the previously set virtual start and end positions. If the field does not exist, it is created. Smart parameters are supported.

Returns

True if the zone is set on the field. Otherwise, returns False if there is an error or if the start and end points for the zone are not set.

Level

Page or Field level.

Details

This action assigns zone coordinates to a field based on previously set start and end positions that were identified using locate actions. Using the actions SetVirtualPageStartPosition and SetVirtualPageEndPosition, a rectangular segment of text from within the current page can be identified at run time and set as a zoned area. This approach can be useful to set the zone position of a field that is not a fixed location but can be determined by searching the recognized text to find the top-left corner and bottom-right corner of the zone area.

A layout file is required to use this action and the CCO must be loaded from the layout file by using the CreateCcoFromLayout action. The recognition of the layout file and creation of the CCO for the page can be performed in the same ruleset or in an earlier ruleset.

Once the zone is set, it can be used just like a zone that is created from a fingerprint. Subsequent actions can be used to process the zoned text.

A field with coordinates set based on the contents of the recognized page can have many uses. A less obvious use is for table identification when the table boundary is not determined by grid lines or the engine is not properly determining the table area even if grid lines exist. In this scenario, use the locate actions to determine the top-left and bottom-right coordinates of the table with steps similar to the example below. This will find the table location based on the text that exists on the page. There would need to be expected text or positions to identify the table boundaries. After calling CreateVirtualZone, then the field can be identified with the variable y_TableZone as described in the help for the OCR/A Recognize action to provide table boundaries for better table identification by making a second call to the Recognize action.

Example:
Recognize()
CreateCcoFromLayout()
WordFind("Hello")
SetVirtualPageStartPosition()
WordFindNext("Good bye")
GoUpLine("1")
GoLastWord()
SetVirtualPageEndPosition()
CreateVirtualZone("MyField")
  
This example recognizes a page, creating a layout file. The CCO is created from the layout file and then Locate actions are used to find the first word to include in the new page. The start of the new page's text segment is identified by calling SetVirtualPageStartPosition. This location is used at the left-top coordinate for the zone. The end of the text segment is located. In this example, the word Good bye indicates it is the end of the desired text. Because the word Good bye should not be included in the new page, the located word position is moved to the last word of the line above the word Good bye. The SetVirtualPageEndPosition then identifies this new position as the bottom-right position for the zone. Finally, the action CreateVirtualZone is called to set the zone for the specified field based on the found text.