FillFieldsInformation Method
Example
Imports Leadtools
Imports Leadtools.Barcode
Imports Leadtools.Codecs
Imports Leadtools.Forms
Imports Leadtools.Forms.Ocr
Imports Leadtools.Forms.Processing
Imports Leadtools.Forms.Recognition
Imports Leadtools.Forms.Recognition.Barcode
Imports Leadtools.Forms.Recognition.Ocr
'''This method will compare form Master Form and if they matched then update Form FormPages.
Public Sub FillFieldsInformation(form As RasterImage, pages As FormPages, formAttributes As FormRecognitionAttributes, masterAttributes As FormRecognitionAttributes, engine As FormRecognitionEngine)
Dim result As FormRecognitionResult = engine.CompareForm(masterAttributes, formAttributes, Nothing)
'check if we have good results then update pages to used in Process stage
If result IsNot Nothing AndAlso result.Reason = FormRecognitionReason.Success AndAlso result.Confidence > 50 Then
'save all pages alignment in List and pass them to FillFieldsInformation
Dim alignments As New List(Of PageAlignment)()
For i As Integer = 0 To result.PageResults.Count - 1
alignments.Add(result.PageResults(i).Alignment)
Next
'the pages will be updated
engine.FillFieldsInformation(form, masterAttributes, formAttributes, pages, alignments)
End If
End Sub
using Leadtools;
using Leadtools.Barcode;
using Leadtools.Codecs;
using Leadtools.Forms;
using Leadtools.Forms.Ocr;
using Leadtools.Forms.Processing;
using Leadtools.Forms.Recognition;
using Leadtools.Forms.Recognition.Barcode;
using Leadtools.Forms.Recognition.Ocr;
///This method will compare form Master Form and if they matched then update Form FormPages.
public void FillFieldsInformation(RasterImage form, FormPages pages, FormRecognitionAttributes formAttributes, FormRecognitionAttributes masterAttributes, FormRecognitionEngine engine)
{
FormRecognitionResult result = engine.CompareForm(masterAttributes, formAttributes, null);
//check if we have good results then update pages to used in Process stage
if (result != null && result.Reason == FormRecognitionReason.Success && result.Confidence > 50)
{
//save all pages alignment in List and pass them to FillFieldsInformation
List<PageAlignment> alignments = new List<PageAlignment>();
for (int i = 0; i < result.PageResults.Count; i++)
alignments.Add(result.PageResults[i].Alignment);
//the pages will be updated
engine.FillFieldsInformation(form, masterAttributes, formAttributes, pages, alignments);
}
}