←Select platform

OcrAutoRecognizeJobProgressEventArgs Class

Summary
Contains data for the IOcrAutoRecognizeManager.JobProgress event.
Syntax
C#
C++/CLI
Python
[SerializableAttribute()] 
public class OcrAutoRecognizeJobProgressEventArgs : EventArgs 
[SerializableAttribute()] 
public ref class OcrAutoRecognizeJobProgressEventArgs : public System.EventArgs  
class OcrAutoRecognizeJobProgressEventArgs(EventArgs): 
Remarks

This is the equivalent of using standard OCR progress callbacks with the IOcrAutoRecognizeManager, the Data member will contain the same data passed to OcrProgressCallback.

Note that the IOcrAutoRecognizeManager.JobProgress will only occur if one thread is used during the recognition process.

IOcrAutoRecognizeManager allows you to modify the raster image, OCR page or OCR document during some parts of the operation. Refer to OcrAutoRecognizeJobOperationEventArgs.PageImage for more information an example.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Ocr; 
using Leadtools.Document.Writer; 
using Leadtools.Forms.Common; 
using Leadtools.WinForms; 
 
public void JobProgressExample() 
{ 
   string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf"); 
 
   // Create an instance of the engine 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
   { 
      // Start the engine using default parameters 
      Console.WriteLine("Starting up the engine..."); 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
      IOcrAutoRecognizeManager ocrAutoRecognizeManager = ocrEngine.AutoRecognizeManager; 
 
      // Run the job in 1 thread 
      ocrAutoRecognizeManager.MaximumThreadsPerJob = 1; 
 
      // Create the job 
      OcrAutoRecognizeJobData ocrJobData = new OcrAutoRecognizeJobData(tifFileName, DocumentFormat.Pdf, pdfFileName); 
      ocrJobData.JobName = "MyJob"; 
      IOcrAutoRecognizeJob ocrJob = ocrAutoRecognizeManager.CreateJob(ocrJobData); 
 
      // Subscribe to the JobProgress event 
      ocrAutoRecognizeManager.JobProgress += new EventHandler<OcrAutoRecognizeJobProgressEventArgs>(ocrAutoRecognizeManager_JobProgress); 
 
      // Run the job 
      ocrAutoRecognizeManager.RunJob(ocrJob); 
 
      // Unsubscribe to the JobProgress event 
      ocrAutoRecognizeManager.JobProgress -= new EventHandler<OcrAutoRecognizeJobProgressEventArgs>(ocrAutoRecognizeManager_JobProgress); 
   } 
} 
 
private static void ocrAutoRecognizeManager_JobProgress(object sender, OcrAutoRecognizeJobProgressEventArgs e) 
{ 
   Console.WriteLine(string.Format("Job: {0} - Page: {1}:{2} - {3} - {4}%", 
      e.Job.JobData.JobName, e.Data.CurrentPageIndex + 1, e.Data.LastPageIndex + 1, e.Data.Operation, e.Data.Percentage)); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime"; 
} 
Requirements

Target Platforms

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

Leadtools.Ocr Assembly

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