To begin using the LEADTOOLS OCR document toolkit, first initialize an OCR document handle. The OCR document handle provides access to the OCR engine and the internal OCR document list of pages.
Calling L_Doc2StartUp initializes the handle. Each call to the L_Doc2StartUp function creates an OCR document handle of type L_HDOC2. The OCR document handle is passed to many of the other LEADTOOLS OCR Document C API functions, so this function must be called before calling any other LEADTOOLS OCR functions.
After the L_Doc2StartUp function has been called, create a settings collection. A settings collection contains the Engine settings, and is used by all the other functions. If a settings collection is not created, errors can result when any of the other OCR functions are called. To avoid such errors, create a settings collection by calling L_Doc2CreateSettingsCollection. Then activate it by calling L_Doc2SetActiveSettingsCollection / L_Doc2SetActiveSettingsCollectionExt. Before shutting down the engine, delete the collection by calling the L_Doc2DeleteSettingsCollection / L_Doc2DeleteSettingsCollectionExt function.
After the L_Doc2StartUp function has been called, you can opt to load engine settings saved in a file into the engine. To load saved settings from a file, call L_Doc2LoadSettings / L_Doc2LoadSettingsExt. To save engine settings into a file for later use, call L_Doc2SaveSettings / L_Doc2SaveSettingsExt.
Be sure to call L_Doc2StartUp before calling 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 / L_Doc2SetProgressCBExt.
When the OCR document handle is no longer needed, free the handle by calling L_Doc2ShutDown. At this point the OCR document handle becomes invalid. Before recognizing any more pages, establish a new OCR document handle by calling L_Doc2StartUp.