Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Steps to Generate a Master Form and save it to a Master repository.

Attributes:

  1. Create and Initialize the Form Recognition Engine using the Forms Recognition Engine.
    				
    FormRecognitionEngine RecognitionEngine = new FormRecognitionEngine();
    
  2. Create and add the desired Object managers using the RecognitionObjectsManager.
    				
    IOcrEngine FormsOcrEngine;
    FormsOcrEngine = OcrEngineManage.CreateEngine(OcrEngineType.Professional, flase);
    FormsOcrEngine.Startup(FormsCodec, System.IO.Path.GetTempPath(), "");
    ocrObjectManager.Engine = FormsOcrEngine;
    RecognitionEngine.ObjectManagers.Add(ocrObjectManager);
    
  3. Create the Master Form (or several) attributes using the CreateMasterForm.
    				
    FormsRecognitionAttributes attributes;
    attributes = RecognitionEngine.CreateMasterForm(name, Guid.Empty, null);
    
  4. Add pages to the Maater Form using the AddMasterFormPage Method. for(int i = 1; i<= image.PageCount; i++) { image.Page = i; AddPageToMasterForm(image, attributes); }
  5. Close the Master Form using the CloseMasterForm Method.
    				
    RecognitionEngine.CloseMasterForm(attributes);
    

Processing Fields:

  1. Create the Form Processing Engine using the FormProcessingEngine Class.
    				
    FormProcessingEngine ProcessingEngine = new FormProcessingEngine();
    
  2. Initialize the Form Processing Engine with the OCR engine, Barcode engine, or both engines.
    				
    IOcrEngine FormsOcrEngine;
    FormsOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Professional, false);
    FormsOcrEngine.Startup(null, null, null);
    ProcessingEngine.OcrEngine = FormsOcrEngine;
    BarcodeEngine.Startup(BarcodeMajorTypeFlags.Barcodes1d |
    BarcodeMajorTypeFlags.Barcodes2dRead | 
    BarcodeMajorTypeFlags.BarcodesDatamatrixRead | 
    BarcodeMajorTypeFlags.BarcodesPdfRead | BarcodeMajorTypeFlags.BarcodesQrRead);
    BarcodeEngine FormsBarcodeEngine = new BarcodeEngine();
    ProcessingEngine.BarcodeEngine = FormsBarcodeEngine;
    
  3. Create the Form Fields list.
    				
    List<FormField> fields;
    
  4. Add your form fields to the lists.
    				
    TextFormField text = new TextFormField();
    text.Name = name;
    text.Bounds = new LogicalRectangle(100, 500, 50, 75, LogicalUnit.Pixel);
    fields.Add(text);
    OmrFormField omr = new OmrFormField();
    omr.Name = name;
    omr.Bounds = new LogicalRectangle(200, 300, 25, 25, LogicalUnit.Pixel);
    fields.Add(omr);
    ImageFormField image = new ImageFormField();
    image.Name = name;
    image.Bounds = new LogicalRectangle(100, 1000, 300, 50, LogicalUnit.Pixel); ;
    fields.Add(image);
    BarcodeFormField barcode = new BarcodeFormField();
    barcode.Name = name;
    barcode.Bounds = new LogicalRectangle(700, 100, 300, 100, LogicalUnit.Pixel);
    fields.Add(barcode);
    
  5. Create a page and add the fields to it.
    				
    FormPage page = new FormPage(image.Page, image.XResolution, image.YResolution);
    page.AddRange(fields);
    
  6. Add pages to the processing engine.
    				
    ProcessingEngine.Pages.Add(formPage);
    

Save Master Form to disk repository:

  1. Create a Repository using the Leadtools.Forms.Auto.DiskMasterFormsRepository Class.
    				
    DiskMasterFormsRepository repository;
    repository = new DiskMasterFormsRepository(codecs, @"C:\Forms\FormsDemo\OCR_Test");
    
  2. Save the Master Form to the repository at the root category.
    				
    repository.RootCategory.AddMasterForm(attributes, ProcessingEngine.Pages, image);
    

See Also