The GetFormAlignment(FormRecognitionAttributes,FormRecognitionAttributes,FormProgressCallback,PageProgressCallback) Method is available as an add-on to the LEADTOOLS Document and Medical Imaging toolkits.
- 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.
Visual Basic (Declaration) | |
---|---|
Overloads Public Function GetFormAlignment( _ ByVal masterAttributes As FormRecognitionAttributes, _ ByVal formAttributes As FormRecognitionAttributes, _ ByVal formCallback As FormProgressCallback, _ ByVal pageCallback As PageProgressCallback _ ) As IList(Of PageAlignment) |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As FormRecognitionEngine Dim masterAttributes As FormRecognitionAttributes Dim formAttributes As FormRecognitionAttributes Dim formCallback As FormProgressCallback Dim pageCallback As PageProgressCallback Dim value As IList(Of PageAlignment) value = instance.GetFormAlignment(masterAttributes, formAttributes, formCallback, pageCallback) |
C# | |
---|---|
public IList<PageAlignment> GetFormAlignment( FormRecognitionAttributes masterAttributes, FormRecognitionAttributes formAttributes, FormProgressCallback formCallback, PageProgressCallback pageCallback ) |
C++/CLI | |
---|---|
public: IList<PageAlignment^>^ GetFormAlignment( FormRecognitionAttributes^ masterAttributes, FormRecognitionAttributes^ formAttributes, FormProgressCallback^ formCallback, PageProgressCallback^ pageCallback ) |
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.
For a complete example on using the forms recognition and processing, refer to the FormRecognitionEngine example.
This example adds a page to the form
Visual Basic | Copy Code |
---|---|
'''This method calculates the alignment for the recognized form. Public Sub AlignForm(ByVal recognitionEngine As FormRecognitionEngine, ByVal form As MyForm, ByVal calculateAlignment As Boolean) If calculateAlignment Then form.Alignment = recognitionEngine.GetFormAlignment(form.Master.Attributes, form.Attributes, Nothing) Else form.Alignment = New List(Of PageAlignment)() Dim i As Integer = 0 Do While i < form.Result.PageResults.Count form.Alignment.Add(form.Result.PageResults(i).Alignment) i += 1 Loop End If End Sub |
C# | Copy Code |
---|---|
///This method calculates the aligmnet for the recognized form. public 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); } } |
Alignment is necessary when processing forms so that data can be extracted correctly. This function returns a Leadtools.Forms.PageAlignment object that aligns a Leadtools.Forms.LogicalRectangle located in the Master Form to its equivalent position in the Form.
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7