←Select platform

JobOperation Event

Occurs while a job is running.
public event EventHandler<OcrAutoRecognizeJobOperationEventArgs> JobOperation 
- (void)autoRecognizeManager:(LTOcrAutoRecognizeManager *)manager willRunOperation:(LTOcrAutoRecognizeJobOperationEventArgs *)operation 
- (void)autoRecognizeManager:(LTOcrAutoRecognizeManager*)manager didRunOperation:(LTOcrAutoRecognizeJobOperationEventArgs*)operation 
synchronized public void addJobOperationListener(OcrAutoRecognizeJobOperationListener listener) 
synchronized public void removeJobOperationListener(OcrAutoRecognizeJobOperationListener listener) 
event EventHandler<OcrAutoRecognizeJobOperationEventArgs^>^ JobOperation 
def JobOperation(sender,e): # sender: IOcrAutoRecognizeManager e: OcrAutoRecognizeJobOperationEventArgs 
Event Data

The event handler receives an argument of type OcrAutoRecognizeJobOperationEventArgs containing data related to this event. The following OcrAutoRecognizeJobOperationEventArgs properties provide information specific to this event.

Document Gets the OCR document being used in the current operation.

This event will occur when Run, RunJob or RunJobAsync is called.

You can use this event to get information on the current operation (creating an OCR document, loading a page, zoning, recognizing, saving, etc.).

using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Ocr; 
using Leadtools.Document.Writer; 
using Leadtools.Forms.Common; 
using Leadtools.WinForms; 
public void JobOperationExample() 
   string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); 
   string documentFileName = Path.Combine(LEAD_VARS.ImagesDir, "JobOperation.pdf"); 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
      IOcrAutoRecognizeManager autoRecognizeManager = ocrEngine.AutoRecognizeManager; 
      autoRecognizeManager.JobOperation += new EventHandler<OcrAutoRecognizeJobOperationEventArgs>(autoRecognizeManager_JobOperation); 
      IOcrAutoRecognizeJob job = autoRecognizeManager.CreateJob(new OcrAutoRecognizeJobData(imageFileName, DocumentFormat.Pdf, documentFileName)); 
      autoRecognizeManager.JobOperation -= new EventHandler<OcrAutoRecognizeJobOperationEventArgs>(autoRecognizeManager_JobOperation); 
private static void autoRecognizeManager_JobOperation(object sender, OcrAutoRecognizeJobOperationEventArgs e) 
   // We did not pass a zone to the job, so the engine will attempt to do AutoZone unless we 
   // add any zone to the input document. 
   // We can also check for e.PostOperation equals to true and manipulate the zones 
   // found the engine at this point 
   // Add a graphics zone. 
   // If you comment out this code, the result PDF will contain text, but since we will be adding a zone here, 
   // the engine will not auto-zone the document for us. Also, since the zone we are adding is 
   // graphics that takes up the whole page, the result PDF will contain a raster image and no text. 
   if (!e.PostOperation && e.ImagePageNumber == 1) 
      OcrZone ocrZone = new OcrZone(); 
      ocrZone.ZoneType = OcrZoneType.Graphic; 
      ocrZone.Bounds = new LeadRect(0, 0, e.Page.Width, e.Page.Height); 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime"; 

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.