←Select platform

ProcessState Enumeration

Summary

Enumeration values that represent the processing state.

Syntax

C#
VB
C++
public enum ProcessState  
Public Enum ProcessState  
    
public enum class ProcessState  

Members

ValueMemberDescription
0Start The processing of fields has started.
1Processed A field has been processed.
2WillProcess A field will be processed.
3Finish The processing of fields has finished. There are no other fields left to process.
Remarks

ProcessState is used in ProgressEventArgs to show the current state of processing.

Example

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms; 
using Leadtools.Forms.Ocr; 
using Leadtools.Forms.Commands; 
 
public void TestBankCheckReader() 
{ 
   // Initialize the RasterCodecs class 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // Initialize the BankCheckReader class 
   BankCheckReader checkReader = new BankCheckReader(); 
 
   // The bank cheque image 
   string chequePath = Path.Combine(LEAD_VARS.ImagesDir, "BankCheck.jpg"); 
   RasterImage image = codecs.Load(chequePath); 
 
   IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false); 
   ocrEngine.Startup(codecs, null, null, LEAD_VARS.OcrAdvantageRuntimeDir); 
   // Assign Engine to Reader 
   checkReader.OcrEngine = ocrEngine; 
 
   // handle Process Event 
   checkReader.Process += new EventHandler<ProgressEventArgs>(reader_Processed); 
 
   // Process Image 
   checkReader.ProcessImage(image); 
 
   ocrEngine.Shutdown(); 
} 
 
void reader_Processed(object sender, ProgressEventArgs e) 
{ 
   Console.WriteLine(string.Format("State      : {0}%", e.State)); 
   Console.WriteLine(string.Format("Percentage : {0}%", e.Percentage)); 
   Console.WriteLine(string.Format("FieldType  : {0}%", e.FieldType.ToString())); 
 
   if (e.State == ProcessState.Finish) 
   { 
      BankCheckReader reader = sender as BankCheckReader; 
      foreach (var value in reader.Results) 
      { 
         LeadRect bounds = value.Value.Bounds; 
         Console.WriteLine(string.Format("Field Name      : {0}", value.Key)); 
         Console.WriteLine(string.Format("Field Value     : {0}", value.Value.Text)); 
         Console.WriteLine(string.Format("Field Bounds    : {0},{0},{0},{0}", bounds.X.ToString(), bounds.Y.ToString(), bounds.Width.ToString(), bounds.Height.ToString())); 
         Console.WriteLine("************************************"); 
      } 
   } 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
   public const string OcrAdvantageRuntimeDir = @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Forms 
Imports Leadtools.Forms.Ocr 
Imports Leadtools.Forms.Commands 
 
Public Sub TestBankCheckReader() 
   ' Initialize the RasterCodecs class 
   Dim codecs As New RasterCodecs() 
 
   ' Initialize the BankCheckReader class 
   Dim checkReader As New BankCheckReader() 
 
   ' The bank cheque image 
   Dim chequePath As String = Path.Combine(LEAD_VARS.ImagesDir, "BankCheck.jpg") 
   Dim image As RasterImage = codecs.Load(chequePath) 
 
   Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False) 
      ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime") 
      ' Assign Engine to Reader 
      checkReader.OcrEngine = ocrEngine 
 
      ' handle Process Event 
      AddHandler checkReader.Process, AddressOf reader_Processed 
 
      ' Process Image 
      checkReader.ProcessImage(image) 
   End Using 
End Sub 
 
Private Sub reader_Processed(sender As Object, e As ProgressEventArgs) 
   Console.WriteLine(String.Format("State      : {0}%", e.State)) 
   Console.WriteLine(String.Format("Percentage : {0}%", e.Percentage)) 
   Console.WriteLine(String.Format("FieldType  : {0}%", e.FieldType.ToString())) 
 
   If e.State = ProcessState.Finish Then 
      Dim reader As BankCheckReader = TryCast(sender, BankCheckReader) 
      If reader IsNot Nothing Then 
         For Each value As KeyValuePair(Of String, BankCheckField) In reader.Results 
            Dim bounds As LeadRect = value.Value.Bounds 
            Console.WriteLine(String.Format("Field Name      : {0}", value.Key)) 
            Console.WriteLine(String.Format("Field Value     : {0}", value.Value.Text)) 
            Console.WriteLine(String.Format("Field Bounds    : {0},{0},{0},{0}", bounds.X.ToString(), bounds.Y.ToString(), bounds.Width.ToString(), bounds.Height.ToString())) 
            Console.WriteLine("************************************") 
         Next 
      End If 
   End If 
End Sub 
 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Commands Assembly