Sample 3. Step 7: Detecting the name of the Invoice Date field with a kwInvoiceDate element
Analysis of the test images reveals that the name of the field Invoice Date is a short and very common word “Date.” This means that we have to restrict the search area as much as possible. You will have noticed that the name of the Date field (whenever it occurs on an image) is located very close to the name of the field Invoice Number.
To create the kwInvoiceDate element:
- In the InvoiceHeader element, create an element of type Static Text and name it kwInvoiceDate.
- Click the Static Text tab.
- In the Search text field, enter the text to find: “Date”.
- Leave 30 as the value for the Max error percentage (for the sought word of 4 letters it means no more than 1 error).
- Click the Relations tab.
- On the Relations tab, specify that the keywords of the name can only occur below the name of the field Invoice Number, but no more than 150 dots below its bottom boundary.
- Below the element kwInvoiceNumber, Offset = 0, and
- Above the bottom of the element kwInvoiceNumber, Offset = -150, Reference boundary = Bottom.
Note.To select the best values for offsets, you may want to analyze the geometrical properties (i.e. size and boundaries) of the objects detected during pre-recognition.
- Click the Advanced tab.
- Since the Invoice Date field is in the left half of the image, set the following additional search constraint in the Advanced pre-search relations field:Look for the object in the left half of the image. In the FlexiLayout language:
LeftOf: PageRect.Left + PageRect.Width/2;
- Try matching the FlexiLayout with the test images and make sure that the program successfully detects the element on all the images where applicable.