Create and Initialize the Form Recognition Engine using the Forms Recognition Engine.
FormRecognitionEngine RecognitionEngine = new FormRecognitionEngine();
Create and add the desired Object managers using the RecognitionObjectsManager.
RasterCodecs.Startup();
RasterCodecs FormsCodec = new RasterCodecs();
DocumentWriter docWriter = null;
string ocrInstallationDirectory = ""; //use default installation
IOcrEngine FormsOcrEngine;
FormsOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);
FormsOcrEngine.Startup(FormsCodec, docWriter, System.IO.Path.GetTempPath(), ocrInstallationDirectory);
OcrObjectsManager ocrObjectManager = new OcrObjectsManager(FormsOcrEngine);
RecognitionEngine.ObjectsManagers.Add(ocrObjectManager);
Create the Master Form (or several) attributes using the CreateMasterForm.
FormRecognitionAttributes attributes;
attributes = RecognitionEngine.CreateMasterForm(name, Guid.Empty, null);
Add pages to the Master Form using the AddMasterFormPage Method.
for(int i = 1; i<= image.PageCount; i++)
{
image.Page = i;
AddPageToMasterForm(image, attributes);
}
Close the Master Form using the CloseMasterForm Method.
RecognitionEngine.CloseMasterForm(attributes);
Create the Form Processing Engine using the FormProcessingEngine Class.
FormProcessingEngine ProcessingEngine = new FormProcessingEngine();
Initialize the Form Processing Engine with the OCR engine, Barcode engine, or both engines.
IOcrEngine FormsOcrEngine;
FormsOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);
FormsOcrEngine.Startup(null, null, null, @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime");
ProcessingEngine.OcrEngine = FormsOcrEngine;
BarcodeEngine FormsBarcodeEngine = new BarcodeEngine();
ProcessingEngine.BarcodeEngine = FormsBarcodeEngine;
Create the Form Fields list.
List<FormField> fields;
Add your form fields to the lists.
TextFormField text = new TextFormField();
text.Name = name;
text.Bounds = new LeadRect(100, 500, 50, 75);
fields.Add(text);
OmrFormField omr = new OmrFormField();
omr.Name = name;
omr.Bounds = new LeadRect(200, 300, 25, 25);
fields.Add(omr);
ImageFormField image = new ImageFormField();
image.Name = name;
image.Bounds = new LeadRect(100, 1000, 300, 50); ;
fields.Add(image);
BarcodeFormField barcode = new BarcodeFormField();
barcode.Name = name;
barcode.Bounds = new LeadRect(700, 100, 300, 100);
fields.Add(barcode);
Create a page and add the fields to it.
FormPage page = new FormPage(image.Page, image.XResolution, image.YResolution);
page.AddRange(fields);
Add pages to the processing engine.
ProcessingEngine.Pages.Add(formPage);
Create a Repository using the Leadtools.Forms.Auto.DiskMasterFormsRepository Class.
DiskMasterFormsRepository repository;
repository = new DiskMasterFormsRepository(codecs, @"C:\Forms\FormsDemo\OCR_Test");
Save the Master Form to the repository at the root category.
repository.RootCategory.AddMasterForm(attributes, ProcessingEngine.Pages, image);
Forms Recognition and Processing FAQ
Forms Recognition and Processing Workflow
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.