←Select platform

OcrAutoRecognizeManagerJobOperation Enumeration


IOcrAutoRecognizeManager job operations.

public enum OcrAutoRecognizeManagerJobOperation   
Public Enum OcrAutoRecognizeManagerJobOperation  
typedef NS_ENUM(NSInteger, LTOcrAutoRecognizeManagerJobOperation) 
public enum OcrAutoRecognizeManagerJobOperation 
public enum class OcrAutoRecognizeManagerJobOperation   

0Other Other operation, such as unexpected and unrecoverable errors.
1CreateDocument The IOcrAutoRecognizeManager is creating a document with IOcrDocumentManager.CreateDocument.
2PrepareDocument Preparing the IOcrDocument, in certain situations, by clearing all the pages inside it.
3LoadPage Loading the image of a page using RasterCodecs.Load. The page is then created using IOcrEngine.CreatePage.
4PreprocessPage Preprocessing a page using IOcrPage.AutoPreprocess.
5ZonePage Zoning a page using IOcrPage.AutoZone or IOcrPage.LoadZone.Note that when using the IOcrAutoRecognizeManager.JobOperation event, you can use this operation to zone the page manually as shown in the OcrAutoRecognizeJobOperationEventArgs example.
6RecognizePage Recognizing a page using IOcrPage.Recognize.
7SavePage Saving a page using IOcrDocument.Save.
8AppendLtd Appending multiple LTD's using DocumentWriter.AppendLtd.
9SaveDocument Saving a document using IOcrDocument.Save.
10ConvertDocument Converting a document to its final format using DocumentWriter.Convert.


Used as type for the following properties:

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.

The OcrAutoRecognizeJobOperationEventArgs.Status property can be set to OcrAutoRecognizeJobStatus.Abort inside the event handler to abort the current operation. Aborting the operation will cause the whole job to be canceled. The only exception is with LoadPage. If Status is set to Abort, then the page will be skipped and not added to the final document. The following code performs custom processing (in this example, blank page detection) to skip specific pages from being added to the final document:

// Our IOcrAutoRecognizeManager.JobOperation event handler 
EventHandler<OcrAutoRecognizeJobOperationEventArgs> jobOperation = (object sender, OcrAutoRecognizeJobOperationEventArgs e) => 
   if (e.Operation == OcrAutoRecognizeManagerJobOperation.LoadPage && !e.PostOperation) 
      // IOcrPage has been created with an image loaded, check if it is empty 
      // Get the image 
      using (RasterImage image = e.Page.GetRasterImage(OcrPageType.Original)) 
         // Run the blank bage detector command 
         var blankPageDetector = new BlankPageDetectorCommand(BlankPageDetectorCommandFlags.None, 0, 0, 0, 0); 
         if (blankPageDetector.IsBlank) 
            // The image is blank, inform the OCR auto recognize manager to skip it 
            e.Status = OcrAutoRecognizeManagerJobStatus.Abort; 
IOcrAutoRecognizeManager ocrAutoRecognizeManager = ocrEngine.AutoRecognizeManager; 
// Create the job 
var jobData = new OcrAutoRecognizeJobData(inputFile, DocumentFormat.Pdf, outputFile); 
IOcrAutoRecognizeJob ocrJob = ocrAutoRecognizeManager.CreateJob(jobData); 
// Add our event 
ocrAutoRecognizeManager.JobOperation += jobOperation; 
// Run the job 
ocrAutoRecognizeManager.JobOperation -= jobOperation; 


For an example, refer to RunJob and OcrAutoRecognizeJobOperationEventArgs.


Target Platforms

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

Leadtools.Ocr Assembly