Leadtools.Forms.Ocr Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
IOcrZoneManager Interface
See Also  Members   Example
Leadtools.Forms.Ocr Namespace : IOcrZoneManager Interface



Support for determining the various zone types, recognition modules and fill methods supported by the OCR engine.

Syntax

Visual Basic (Declaration) 
Public Interface IOcrZoneManager 
Visual Basic (Usage)Copy Code
Dim instance As IOcrZoneManager
C# 
public interface IOcrZoneManager 
C++/CLI 
public interface class IOcrZoneManager 

Example

This example will show the different zone types, recognition modules and fill types supported by the Plus OCR engine.

Visual BasicCopy Code
Public Sub ZoneManagerExample()
   ' Unlock the support needed for LEADTOOLS Plus OCR engine
   RasterSupport.Unlock(RasterSupportType.Document, "Replace with your own key here")
   RasterSupport.Unlock(RasterSupportType.OcrPlus, "Replace with your own key here")
   RasterSupport.Unlock(RasterSupportType.OcrPlusPdfLeadOutput, "Replace with your own key here")
   ' Create an instance of the engine
   Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Plus, False)
      ' Start the engine using default parameters
      ocrEngine.Startup(Nothing, Nothing, Nothing, Nothing)

      ' Get the zone manager
      Dim ocrZoneManager As IOcrZoneManager = ocrEngine.ZoneManager

      ' Show all the zone types supported by this engine
      Console.WriteLine("Hit enter to show the supported zone types")
      Console.ReadLine()

      Dim zoneTypes() As OcrZoneType = ocrZoneManager.GetSupportedZoneTypes()
      Console.WriteLine("Supported zone types:")
      Console.WriteLine("---------------------")
      For Each zoneType As OcrZoneType In zoneTypes
         Console.WriteLine(" {0}", zoneType)
      Next

      Console.WriteLine("Hit enter to show the supported recognition modules")
      Console.ReadLine()

      Dim recognitionModules() As OcrZoneRecognitionModule = ocrZoneManager.GetSupportedRecognitionModules()
      Console.WriteLine("Supported recognition modules:")
      Console.WriteLine("---------------------")
      For Each recognitionModule As OcrZoneRecognitionModule In recognitionModules
         Console.WriteLine(" {0}", recognitionModule)
      Next

      Console.WriteLine("Hit enter to show the supported fill methods")
      Console.ReadLine()

      Dim fillMethods() As OcrZoneFillMethod = ocrZoneManager.GetSupportedFillMethods()
      Console.WriteLine("Supported fillMethods:")
      Console.WriteLine("---------------------")
      For Each fillMethod As OcrZoneFillMethod In fillMethods
         Console.WriteLine(" {0}", fillMethod)
      Next

      ' Shutdown the engine
      ' Note: calling Dispose will also automatically shutdown the engine if it has been started
      ocrEngine.Shutdown()
   End Using
End Sub
C#Copy Code
public void ZoneManagerExample() 

   // Unlock the support needed for LEADTOOLS Plus OCR engine 
   RasterSupport.Unlock(RasterSupportType.Document, "Replace with your own key here"); 
   RasterSupport.Unlock(RasterSupportType.OcrPlus, "Replace with your own key here"); 
   RasterSupport.Unlock(RasterSupportType.OcrPlusPdfLeadOutput, "Replace with your own key here"); 
   // Create an instance of the engine 
   using(IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Plus, false)) 
   { 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, null); 
 
      // Get the zone manager 
      IOcrZoneManager ocrZoneManager = ocrEngine.ZoneManager; 
 
      // Show all the zone types supported by this engine 
      Console.WriteLine("Hit enter to show the supported zone types"); 
      Console.ReadLine(); 
 
      OcrZoneType[] zoneTypes = ocrZoneManager.GetSupportedZoneTypes(); 
      Console.WriteLine("Supported zone types:"); 
      Console.WriteLine("---------------------"); 
      foreach(OcrZoneType zoneType in zoneTypes) 
         Console.WriteLine("  {0}", zoneType); 
 
      Console.WriteLine("Hit enter to show the supported recognition modules"); 
      Console.ReadLine(); 
 
      OcrZoneRecognitionModule[] recognitionModules = ocrZoneManager.GetSupportedRecognitionModules(); 
      Console.WriteLine("Supported recognition modules:"); 
      Console.WriteLine("---------------------"); 
      foreach(OcrZoneRecognitionModule recognitionModule in recognitionModules) 
         Console.WriteLine("  {0}", recognitionModule); 
 
      Console.WriteLine("Hit enter to show the supported fill methods"); 
      Console.ReadLine(); 
 
      OcrZoneFillMethod[] fillMethods = ocrZoneManager.GetSupportedFillMethods(); 
      Console.WriteLine("Supported fillMethods:"); 
      Console.WriteLine("---------------------"); 
      foreach(OcrZoneFillMethod fillMethod in fillMethods) 
         Console.WriteLine("  {0}", fillMethod); 
 
      // Shutdown the engine 
      // Note: calling Dispose will also automatically shutdown the engine if it has been started 
      ocrEngine.Shutdown(); 
   } 
}

Remarks

You can access the instance of the IOcrZoneManager used by an IOcrEngine through the IOcrEngine.ZoneManager property.

When calling the IOcrPage.AutoZone method on a page, the generated zone's type (OcrZone.ZoneType), recognition module (OcrZone.RecognitionModule) and fill method (OcrZone.FillMethod) will always be one of the supported values as reported by the IOcrZoneManager.

Before manually changing any of the above zone properties, you must determine whether the particular value is supported by this instance of IOcrEngine. You do this by using the instance of IOcrZoneManager of the engine through the IOcrEngine.ZoneManager property as follows:

To get all the supported zone types, recognition modules or fill methods use GetSupportedZoneTypes, GetSupportedRecognitionModules and GetSupportedFillMethods respectively.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

IOcrZoneManager requires an OCR module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features