Sample 3. Step 6: Detecting the name of the Invoice Number field with a the kwInvoiceNumber element
Analysis of the images reveals that the name of the field Invoice Number occurs on all the images and distinguishes them from other document types. When processing semi-structured documents in ABBYY FlexiCapture, you will want to avoid accidental recognition of documents which do not belong to the selected type. One way to identify a document is to create at least one required element. So we will mark this element as required, i.e. use it as an identifier for this type of document.
Note that on some of the images this name is written as Invoice No., while on others it is written as Credit note no. Our search string must include both these variants, and we will specify each of the strings without spaces. In this case the maximum number of errors will apply to the entire phrase, not to separate words.
To create the kwInvoiceNumber element:
- In the InvoiceHeader element, create an element of type Static Text and name it kwInvoiceNumber.
- Select Required element on the General tab (we have decided to make this element a required element).
- Click the Static Text tab.
- In the Search text field, enter the text to find: “InvoiceNo.|CreditNoteNo”.
- Set Max error percentage to 20.
- Click the Relations tab.
- On the Relations tab, specify that the keywords of the name of the Invoice Number field can only occur below the name of the field Delivery Address:
- Below the element InvoiceHeader.kwDeliveryAddress, Offset = 0.
- Click the Advanced tab.
- Since the Delivery Address field is in the upper third and in the left third of the image, set the following additional search constraint in the Advanced pre-search relations field:
Look for the object in the left third of the image; Look for the object in the upper third of the image. In the FlexiLayout language:
Above: PageRect.Top + PageRect.Height/3;
LeftOf: PageRect.Left + PageRect.Width/3;
- Try matching the FlexiLayout with the test images and make sure that the program successfully detects the element on all the images.
Note.In practice, if the wording of a field name differs from image to image, you must be sure to specify all the possible variants of the name, or at least the majority of them. You may want to ask for more test images or contact your customer to learn about the possible variants of the name on the documents of this type.