LEADTOOLS OCR C DLL Help > Getting Started with LEADTOOLS Character Recognition > Starting and Shutting Down the Engine |
To begin using the LEADTOOLS OCR document toolkit, first initialize an OCR document handle. This handle provides access to the OCR engine and the internal OCR document list of pages.
OCR Plus
Calling the L_DocStartUp function initializes the handle. Each call to the L_DocStartUp function will create an OCR document handle of type L_HDOC. This handle is passed to many of the other LEADTOOLS OCR Document C DLL functions, so this function must be called before calling other LEADTOOLS OCR functions.
Once the L_DocStartUp function has been called, you may opt to load engine settings saved in a file into the engine. To load saved settings from a file, call L_DocLoadSettings. To save engine settings into a file for later use, call L_DocSaveSettings. Please note that you must call L_DocStartUp before you can call L_DocSaveSettings. If you call L_DocSaveSettings after calling L_DocStartUp, but before you have set any engine settings, the settings files will contain the default engine settings.
While working with the OCR engine, you can receive progress notifications for all processes performed by the OCR engine if you set a PROGRESSCALLBACK function using L_DocSetProgressCB.
When the OCR document handle is no longer needed, the user must free the handle by calling L_DocShutDown. At this point the OCR document handle becomes invalid. Before recognizing any more pages, the user must establish a new OCR document handle by calling L_DocStartUp.
OCR Professional
Calling the L_Doc2StartUp function initializes the handle. Each call to the L_Doc2StartUp function will create an OCR document handle of type L_HDOC2. This handle is passed to many of the other LEADTOOLS OCR Document C DLL functions, so this function must be called before calling other LEADTOOLS OCR functions.
Once the L_Doc2StartUp function has been called, you need to create a settings collection. A settings contains the Engine settings, and is used by all the other functions. If a settings collection is not created, errors may result when any of the other OCR functions are called. So, to avoid such errors, create a settings collection by calling L_Doc2CreateSettingsCollection function. Then activate it by calling the L_Doc2SetActiveSettingsCollection function. Before shutting down the engine, delete the collection by calling the L_Doc2DeleteSettingsCollection function.
After the L_Doc2StartUp function has been called, you may opt to load engine settings saved in a file into the engine. To load saved settings from a file, call L_Doc2LoadSettings. To save engine settings into a file for later use, call L_Doc2SaveSettings. Please note that you must call L_Doc2StartUp before you can call L_Doc2SaveSettings. If you call L_Doc2SaveSettings after calling L_Doc2StartUp, but before you have set any engine settings, the settings files will contain the default engine settings.
While working with the OCR engine, you can receive progress notifications for all processes performed by the OCR engine if you set a PROGRESSCALLBACK2 function using L_Doc2SetProgressCB.
When the OCR document handle is no longer needed, the user must free the handle by calling L_Doc2ShutDown. At this point the OCR document handle becomes invalid. Before recognizing any more pages, the user must establish a new OCR document handle by calling L_Doc2StartUp.