Auto Recognize And Process A Form

Take the following steps to start a project and to add some code that creates a set of master forms and uses them to recognize and process a form using LEADTOOLS High Level Forms Interface:

Start Visual Studio.

Choose File->New->Project... from the menu.

In the New Project dialog box, choose either "Visual C# Projects" or "VB Projects" in the Projects Type List, and choose "Windows Application" in the Templates List.

Type the project name as "Recognizing and Processing a Form" in the Project Name field, and then choose OK. If desired, type a new location for your project or select a directory using the Browse button, and then choose OK.

In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference…" from the context menu. In the "Add Reference" dialog box, select the ".NET" tab, browse to the "<LEADTOOLS_INSTALLDIR>\Bin\Dotnet\Win32" folder, and select the following DLLs:

Leadtools.dll

Leadtools.Barcode.dll

Leadtools.Forms.Auto.dll

Leadtools.Forms.Common.dll

Leadtools.Document.Writer.dll

Leadtools.Ocr.dll

Leadtools.Forms.Processing.dll

Leadtools.Forms.Recognition.dll

Leadtools.Codecs.dll

Leadtools.Codecs.Tif.dll

Leadtools.Codecs.Fax.dll

Leadtools.Ocr.LEADEngine.dll

Add the following lines at the top of the Form1.cs/Form1.vb file:

C#

using Leadtools; using Leadtools.Codecs; using Leadtools.Forms.Common; using Leadtools.Ocr; using Leadtools.Forms.Processing; using Leadtools.Forms.Recognition; using Leadtools.Forms.Auto; using System.IO;

LEADTOOLS ships several sample master and filled forms which we will use for this tutorial. The path to the images is hard-coded to the default install location so if you chose another path, you will need to change it accordingly. Add a button to the form and set its Text property to "Recognize and Process Form" then double-click it and add the following code to its handler:

Set the output folder of the project .exe to where LEADTOOLS .Net DLLs are installed. For example: <LEADTOOLS_INSTALLDIR>\Bin\Dotnet4\Win32.

Run the project and test it. Click the "Recognize and Process Form" button which will load a sample form image, recognize and process it, and display the results.
NOTE: If you encounter an "Invalid File Format" or "Feature Not Supported" exception, please refer to the topic Invalid File Format/Feature Not Supported.