English (English)

Describing text fields containing framed letters

Sometimes you may need to create a FlexiLayout to look for fields which typically occur on traditional documents with a fixed layout. For example, you may need to describe a field in which letters must be entered into small frames. A typical example would be a company collecting documents from its regional offices. Even if the documents are expected to look the same, there may be subtle differences in layouts from one regional office to another, which means that they cannot be processed using a single "hard" Document Definition. In this case one FlexiLayout may be preferable to several slightly different "hard" Document Definitions.

If data fields sought on the document are of "framed letters" or "separate framed letters" type, a separator-based search for the boundaries of such fields can be very complicated, and the description of elements can turn bulky, particularly if the names for such fields are not available or uncertainly recognized. Moreover, it is very important that the block contain not only these fields but the entire frame as well. If separator lines are thin, they may sometimes be misprinted or lost during scanning. In such cases it is recommended to search for the boundaries using White Gap elements. Such field boundaries are described in the special FlexiLayout language in the Expression field of the block's Properties dialog box. You can describe the top boundary of the field as the bottom of the top white gap, the bottom boundary as the top of the bottom white gap, the right boundary of the field as the left boundary of the right white gap, and the left boundary of the field as the right boundary of the left white gap.

A FlexiLayout Studio project which contains test images and a tested FlexiLayout can be found in %public%\ABBYY\FlexiCapture\12.0\Samples\FLS\Tips and Tricks.

Example

Let us assume that all the 4 gaps (LeftGapName, RightGapName, TopGapName, BottomGapName) which are required to formally describe the location of the data field in the picture have been found.

The code in the Expression field will then look as follows:

Rect outputRect;
Let FieldLeft = LeftGapName.Rect.Right;
Let FieldRight = RightGapName.Rect.Left;
Let FieldTop = TopGapName.Rect.Bottom;
Let FieldBottom = BottomGapName.Rect.Top;
outputRect = Rect(FieldLeft, FieldTop, FieldRight, FieldBottom);
OutputRegion = outputRect;

Note.Instead of "LeftGapName", "RightGapName", "TopGapName" and "BottomGapName" you should put the names of the corresponding White gap elements. If required, you can extend the field's width and height by using the Inflate option.

If data fields sought on the document are multiple-line fields which have the marking of "framed letters" or "separate framed letters" type, and the lines are not separated from each other by gaps, then you should look for top, bottom, right and left boundaries by using White Gap elements. Search for individual lines should then be specified by a special algorithm in the Expression field. In the given example, the height of each individual line can be calculated by dividing the height of the entire field by 2.

25.05.2023 7:55:03

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.