←Select platform

OcrAutoRecognizeManagerJobOperation Enumeration

Summary

IOcrAutoRecognizeManager job operations.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
public enum OcrAutoRecognizeManagerJobOperation   
Public Enum OcrAutoRecognizeManagerJobOperation  
    
    
public enum OcrAutoRecognizeManagerJobOperation    
typedef NS_ENUM(NSInteger, LTOcrAutoRecognizeManagerJobOperation) 
public enum OcrAutoRecognizeManagerJobOperation 
Leadtools.Forms.Ocr.OcrAutoRecognizeManagerJobOperation = function() { }; 
Leadtools.Forms.Ocr.OcrAutoRecognizeManagerJobOperation.prototype = {<br/> 
  Other = 0, 
    CreateDocument = 1, 
    PrepareDocument = 2, 
    LoadPage = 3, 
    PreprocessPage = 4, 
    ZonePage = 5, 
    RecognizePage = 6, 
    SavePage = 7, 
    AppendLtd = 8, 
    SaveDocument = 9, 
    ConvertDocument = 10, 
     
 }; 
public enum class OcrAutoRecognizeManagerJobOperation   

Members

ValueMemberDescription
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 or IOcrDocument.SaveAsync.
8AppendLtd Appending multiple LTD's using DocumentWriter.AppendLtd.
9SaveDocument Saving a document using IOcrDocument.Save or IOcrDocument.SaveAsync.
10ConvertDocument Converting a document to its final format using DocumentWriter.Convert.
Remarks

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); 
         blankPageDetector.Run(image); 
         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.RunJob(ocrJob); 
ocrAutoRecognizeManager.JobOperation -= jobOperation; 

Example

For an example, refer to RunJob and OcrAutoRecognizeJobOperationEventArgs.

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.Ocr Assembly