#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrAutoRecognizeManager_Run(autoRecognizeManager, imageFileName, documentFileName, format, zonesFileName)
Converts an image file on disk to a document file in the specified document format with optional multipage zone file.
Handle to the OCR engine auto recognize manager.
The name of the file containing the image.
The name of the result document file.
The output document format.
Optional name of prepared multipage zone file. This parameter can be NULL.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This method will perform the following operations:
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 multipage 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.
When all pages are processed they will be saved to result file name specified in documentFileName using the format specified format.
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
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;
}