GetFormAlignment(FormRecognitionAttributes,FormRecognitionAttributes,FormProgressCallback,PageProgressCallback) Method

Summary
Returns a list of Leadtools.Forms.Common.PageAlignment objects that determines the amount of shift and scaling for each page of the Form with its corresponding page in the specified Master Form.
Syntax
C#
VB
C++
  
Public Overloads Function GetFormAlignment( _ 
   ByVal masterAttributes As FormRecognitionAttributes, _ 
   ByVal formAttributes As FormRecognitionAttributes, _ 
   ByVal formCallback As FormProgressCallback, _ 
   ByVal pageCallback As PageProgressCallback _ 
) As IList(Of PageAlignment) 

Parameters

masterAttributes
The Master Form attributes object.

formAttributes
The Form attributes object.

formCallback
Provides status on the progress of the alignment calculations at the form level (i.e. page by page). Set it to null to ignore the progress.

pageCallback
Provides status on the progress of the alignment calculations at the page level. Set it to null to ignore the progress.

Return Value

A list of Leadtools.Forms.Common.PageAlignment objects that determines the amount of shift and scaling for each page of the Form with its corresponding page in the specified Master Form.

Remarks

Alignment is necessary when processing forms so that data can be extracted correctly. This function returns a Leadtools.Forms.Common.PageAlignment object that aligns a LeadRect located in the Master Form to its equivalent position in the Form.

Example

For a complete example on using the forms recognition and processing, refer to the FormRecognitionEngine example.

This example adds a page to the form

C#
VB
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Forms.Processing; 
using Leadtools.Forms.Recognition; 
using Leadtools.Forms.Recognition.Barcode; 
using Leadtools.Forms.Recognition.Ocr; 
 
///This method calculates the aligmnet for the recognized form. 
private void AlignForm(FormRecognitionEngine recognitionEngine, MyForm form, bool calculateAlignment) 
{ 
   if (calculateAlignment) 
   { 
      form.Alignment = recognitionEngine.GetFormAlignment(form.Master.Attributes, form.Attributes, null); 
   } 
   else 
   { 
      form.Alignment = new List<PageAlignment>(); 
      for (int i = 0; i < form.Result.PageResults.Count; i++) 
         form.Alignment.Add(form.Result.PageResults[i].Alignment); 
   } 
} 
Imports Leadtools 
Imports Leadtools.Barcode 
Imports Leadtools.Codecs 
Imports Leadtools.Forms.Common 
Imports Leadtools.Ocr 
Imports Leadtools.Forms.Processing 
Imports Leadtools.Forms.Recognition 
Imports Leadtools.Forms.Recognition.Barcode 
Imports Leadtools.Forms.Recognition.Ocr 
 
'''This method calculates the aligmnet for the recognized form. 
Private Sub AlignForm(recognitionEngine As FormRecognitionEngine, form As MyForm, calculateAlignment As Boolean) 
   If calculateAlignment Then 
      form.Alignment = recognitionEngine.GetFormAlignment(form.Master.Attributes, form.Attributes, Nothing) 
   Else 
      form.Alignment = New List(Of PageAlignment)() 
      For i As Integer = 0 To form.Result.PageResults.Count - 1 
         form.Alignment.Add(form.Result.PageResults(i).Alignment) 
      Next 
   End If 
End Sub 
Requirements

Target Platforms

Help Version 21.0.2021.3.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Recognition Assembly