L_OcrAutoRecognizeManager_Run

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrAutoRecognizeManager_Run(autoRecognizeManager, imageFileName, documentFileName, format, zonesFileName)

L_OcrAutoRecognizeManager autoRecognizeManager; handle to the OCR auto recognize manager
const L_TCHAR* imageFileName; the name of the file containing the image
const L_TCHAR* documentFileName; the name of the result document file
DOCWRTFORMAT format; the output document format
const L_TCHAR* zonesFileName; optional name of prepared multi-page zone file. This parameter can be NULL

Converts an image file on disk to a document file in the specified document format with optional multi-page zone file.

Parameter Description
autoRecognizeManager Handle to the OCR engine auto recognize manager.
imageFileName The name of the file containing the image.
documentFileName The name of the result document file.
format The output document format.
zonesFileName Optional name of prepared multi-page zone file. This parameter can be NULL.

Returns

SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This method will perform the following operations:

  1. The L_OcrAutoRecognizeRunJobCallback callback will be fired to indicate that job just started.
  2. Creates one ore more L_OcrPage. The number of created OCR pages conforms to the following formula: MIN(8, maximum CPUs/cores), so if you have more than 8 cores on your machine only 8 threads will be created but if you have less that 8 cores then that number will be used to determine the number of threads to be created to participate in the recognition process. Also the internal created OCR document will be created as disk-based.
  3. Loops through all the pages in imageFileName and for each page:
    1. The page is created using L_OcrPage_FromBitmap after we load the file into BITMAPHANDLE.
    2. If zonesFileName contains a valid multi-page zone file name and has an entry for the current page, then the zones are loaded with L_OcrPage_LoadZonesFile and applied to the page. If zonesFileName is a NULL or is empty string or it does not contain an equivalent page number, auto-decomposing of the page is performed instead with L_OcrPage_AutoZone.
    3. L_OcrPage_Recognize is called to get the OCR data of the page.
    4. The page is added to the internal OCR document using L_OcrDocument_AddPage.

  4. When all pages are processed they will be saved to result file name specified in documentFileName using the format specified format.

  5. All OCR documents and temporary files are deleted.
  6. The L_OcrAutoRecognizeRunJobCallback callback will be fired to indicate that the job has completed or aborted.
  7. You can use the L_OcrAutoRecognizeJobOperationCallback to get information regarding the current operation being performed. For more information and an example, refer to L_OcrAutoRecognizeManager_SetJobOperationCallback.

The L_OcrAutoRecognizeManager also has some options that you can control, For more information about these options, refer to L_OcrAutoRecognizeManager_GetOptions and L_OcrAutoRecognizeManager_SetOptions.

Required DLLs and Libraries

LTOCR
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
See Also
Functions: L_OcrAutoRecognizeManager_GetOptions, L_OcrAutoRecognizeManager_SetOptions, L_OcrAutoRecognizeManager_GetJobOperationCallback, L_OcrAutoRecognizeManager_SetJobOperationCallback, L_OcrAutoRecognizeManager_GetRunJobCallback, L_OcrAutoRecognizeManager_SetRunJobCallback, L_OcrAutoRecognizeManager_CreateJob, L_OcrAutoRecognizeManager_RunJob, L_OcrAutoRecognizeManager_RunJobAsync, L_OcrAutoRecognizeManager_AbortAllJobs
Topics: Programming with LEADTOOLS OCR Module - LEAD Engine
Starting and Shutting Down the OCR Engine
Recognizing OCR Pages
Working With OCR Pages

Example

L_INT L_OcrAutoRecognizeManager_RunExample() 
{ 
   L_INT retCode = -1; 
   L_OcrEngine ocrEngine = NULL; 
   L_OcrAutoRecognizeManager autoRecognizeManager = NULL; 
 
   // Create an instance of the engine 
   retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine); 
   if(retCode != SUCCESS) 
      return retCode; 
 
   // Start the engine using default parameters 
   retCode =L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR); 
   if(retCode != SUCCESS) 
      return retCode; 
 
   // Get the AutoRecognizeManager 
   L_OcrEngine_GetAutoRecognizeManager(ocrEngine, &autoRecognizeManager); 
 
   // Recognize the document 
   retCode = L_OcrAutoRecognizeManager_Run(autoRecognizeManager, MAKE_IMAGE_PATH(L_TEXT("OCR1.tif")), MAKE_IMAGE_PATH(L_TEXT("OCR1.pdf")), DOCUMENTFORMAT_PDF, NULL); 
 
   //CLEANUP 
   L_OcrEngine_Destroy(ocrEngine); 
 
   return retCode; 
} 

Help Version 20.0.2018.2.22
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS OCR Module - LEAD Engine C API Help