- To the right of and below the field name
- Using a White Gap element to limit the search area from the bottom
- Using a Paragraph element
Create the grAddress group element
To specify the properties common to all these elements, create a Group element.- In the InvoiceHeader element, create an element of type Group and name it grAddress.
- Click the Relations tab and specify the following search constraints for the elements of the group:
- Above the kwDeliveryAddress element, Offset = -400.
- Left of the right boundary of the kwDeliveryAddress element, Offset = -800, Reference boundary = Right.
- Right of the left boundary of the kwDeliveryAddress element, Offset = -50, Reference boundary = Left.
- Below the upper boundary of the kwDeliveryAddress element, Offset = -20, Reference boundary = Top.
Create the wgAddressAbove White Gap element
To limit the search area for the DeliveryAddress element from the bottom, specify a horizontal White Gap.-
In the
InvoiceHeader.grAddresselement, create an element of type White Gap and name it wgAddressAbove. - Click the White Gap tab.
- Under Orientation, select Horizontal. Set Min height to 55.
- Because you are looking for a white gap inside a paragraph, under Search among objects of type, select only Text.
-
Under Rubbish, specify the following values:
- Lower threshold limit – 20.
- Upper threshold limit – 80.
- Threshold coefficient (%) – 10.
The values for the Lower threshold limit, Upper threshold limit, and Threshold coefficient (%) properties can only be selected by trial and error. Start with the default values. If the default values do not work, alter them until the white gap is detected on all the test images. - Do not specify any additional search constraints and retain the default values for the other options.
- Click the Relations tab.
-
Since the white gap can be located only beneath the keywords of the name kwDeliveryAddress, specify the following search constraints:
- Below the kwDeliveryAddress element, Offset = 20
Offset is required to prevent the program from finding white gaps in other areas on the image, for example, between the field name and the text. Click the Advanced tab.
- Below the kwDeliveryAddress element, Offset = 20
-
Since the Delivery Address field is not present on all of the images, but when it does occur it is always accompanied by its name, specify the following additional condition in the Advanced pre-search relations field: Search for the image object only if the kwDeliveryAddress element is detected. In the FlexiLayout language, this condition can be written as follows:
- Match the FlexiLayout to see if the wgAddressAbove element is detected on all images.
-
Since the program sometimes finds more than one white gap in the specified search area and cannot always select the right one, impose additional search constraints. If you examine the images, you will notice that the white gap of interest is the topmost gap in the given search area. Therefore, in the Advanced pre-search relations field, specify the following additional condition: Search for an image object closest to the upper boundary of the first page. In the FlexiLayout language, this condition can be written as follows:
- Temporarily exclude the InvoiceFooter element and match the FlexiLayout.
Create the DeliveryAddress Paragraph element
-
In the
InvoiceHeader.grAddresselement, create an element of type Paragraph and name it DeliveryAddress. - Click the Relations tab.
-
Since DeliveryAddress can be located only above the white gap wgAddressAbove, specify the following search constraint:
- Above the wgAddressAbove element, Offset = 0.
-
Since the search area for the DeliveryAddress element has already been specified at the level of the
InvoiceHeader.grAddressgroup, there is no need to specify it again here. - Click the Advanced tab.
-
Since the name of the DeliveryAddress field is also located inside the search area, exclude it to obtain only the value of DeliveryAddress. Additionally, there are separators and noise in the search area that are also best excluded. For these reasons, you cannot just exclude the region of the kwDeliveryAddress element. It is more appropriate to take the region of the kwDeliveryAddress element, enlarge this region so that it encompasses all the noise, and then exclude the resulting rectangle. To do this, specify the following search constraints in the Advanced pre-search relations field:
- Temporarily exclude the InvoiceFooter element and match the FlexiLayout.
-
Specify the location of the DeliveryAddress block as the rectangular region of the detected DeliveryAddress element, simplified for clearer display and expanded by 5 dots vertically and horizontally. To do this, select the Expression option and type the following expression:
