←Select platform

ProcessState Enumeration

Summary
Enumeration values that represent the processing state.
Syntax
C#
C++/CLI
Java
Python
public enum ProcessState  
public final class ProcessState 
    extends java.lang.Enum<ProcessState> 
public enum class ProcessState  
class ProcessState(Enum): 
   Start = 0 
   Processed = 1 
   WillProcess = 2 
   Finish = 3 
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#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.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.LEAD); 
   ocrEngine.Startup(codecs, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
   // Assign Engine to Reader 
   checkReader.OcrEngine = ocrEngine; 
 
   //Set MICR code type 
   checkReader.MicrFontType = BankCheckMicrFontType.E13b; 
 
   // 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:\LEADTOOLS23\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.forms.commands.BankCheckMicrFontType; 
import leadtools.forms.commands.BankCheckReader; 
import leadtools.forms.commands.MRTDErrors; 
import leadtools.forms.commands.MRTDReader; 
import leadtools.forms.commands.ProcessListener; 
import leadtools.forms.commands.ProcessState; 
import leadtools.forms.commands.ProgressEvent; 
import leadtools.ocr.OcrEngine; 
import leadtools.ocr.OcrEngineManager; 
import leadtools.ocr.OcrEngineType; 
 
 
public void TestBankCheckReader() { 
   RasterCodecs codecs = new RasterCodecs(); 
   BankCheckReader checkReader = new BankCheckReader(); 
 
   // The bank cheque image 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String chequePath = combine(LEAD_VARS_ImagesDir, "BankCheck.jpg"); 
   RasterImage image = codecs.load(chequePath); 
   String LEAD_VARS_OcrLEADRuntimeDir = "C:\\LEADTOOLS23\\Bin\\Common\\OcrLEADRuntime"; 
   OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD); 
   ocrEngine.startup(codecs, null, null, LEAD_VARS_OcrLEADRuntimeDir); 
 
   // Assign Engine to Reader 
   checkReader.setOcrEngine(ocrEngine); 
 
   // Set MICR code type 
   checkReader.setMicrFontType(BankCheckMicrFontType.E13B); 
 
   // Handle Process Event 
   checkReader.addProcessListener(reader_Processed); 
 
   // Process Image 
   try { 
      checkReader.processImage(image); 
   } 
   catch (Exception ex) { 
      System.out.println(ex.getMessage()); 
   } 
 
   // Cleanup 
   ocrEngine.shutdown(); 
   ocrEngine.dispose(); 
   codecs.dispose(); 
   image.dispose(); 
} 
 
ProcessListener reader_Processed = new ProcessListener() { 
 
   @Override 
   public void onProcess(Object sender, ProgressEvent e) { 
      System.out.println(String.format("State      : %s%", e.getState())); 
      System.out.println(String.format("Percentage : %s%", e.getPercentage())); 
      System.out.println(String.format("FieldType  : %s%", e.getFieldType().toString())); 
 
      if (e.getState() == ProcessState.FINISH) { 
         BankCheckReader reader = (BankCheckReader) sender; 
         for (var value : reader.getResults().values()) { 
            LeadRect bounds = value.getBounds(); 
            System.out.println(String.format("Field Name      : %s", value)); 
            System.out.println(String.format("Field Value     : %s", value.getText())); 
            System.out.println(String.format("Field Bounds    : %1s,%2s,%3s,%4s", bounds.getX(), bounds.getY(), 
                  bounds.getWidth(), bounds.getHeight())); 
            System.out.println("************************************"); 
         } 
      } 
   } 
 
}; 
Requirements

Target Platforms

Help Version 23.0.2024.5.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Commands Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.