public enum OcrAutoRecognizeManagerJobOperation
Public Enum OcrAutoRecognizeManagerJobOperation
typedef NS_ENUM(NSInteger, LTOcrAutoRecognizeManagerJobOperation)
public enum OcrAutoRecognizeManagerJobOperation
public enum class OcrAutoRecognizeManagerJobOperation
Value | Member | Description |
---|---|---|
0 | Other | Other operation, such as unexpected and unrecoverable errors. |
1 | CreateDocument | The IOcrAutoRecognizeManager is creating a document with IOcrDocumentManager.CreateDocument. |
2 | PrepareDocument | Preparing the IOcrDocument, in certain situations, by clearing all the pages inside it. |
3 | LoadPage | Loading the image of a page using RasterCodecs.Load. The page is then created using IOcrEngine.CreatePage. |
4 | PreprocessPage | Preprocessing a page using IOcrPage.AutoPreprocess. |
5 | ZonePage | 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. |
6 | RecognizePage | Recognizing a page using IOcrPage.Recognize. |
7 | SavePage | Saving a page using IOcrDocument.Save. |
8 | AppendLtd | Appending multiple LTD's using DocumentWriter.AppendLtd. |
9 | SaveDocument | Saving a document using IOcrDocument.Save. |
10 | ConvertDocument | Converting a document to its final format using DocumentWriter.Convert. |
Used as type for the following properties:
The OcrAutoRecognizeManagerJobError.Operation property to indicate the operation that cause the error.
You can set IOcrAutoRecognizeManager.JobErrorMode to OcrAutoRecognizeManagerJobErrorMode.Continue to log and continue when a none critical error occurs during the recognition process. The following errors are considered unrecoverable and the recognition will fail regardless on the current error mode: Other, CreateDocument, PrepareDocument, LoadPage, SavePage, AppendLtd, SaveDocument and Convert.
The OcrAutoRecognizeJobOperationEventArgs.Operation property to indicate the operation being run.
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;
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.