L_Doc2StartUp

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2StartUp(phDoc, pszEnginePath, bUseThunk)

Starts the OCR document engine and initializes the handle.

Parameters

L_HDOC2 * phDoc

Pointer to a document handle to be updated with the initialized OCR document handle. Use this handle in other OCR functions.

L_TCHAR * pszEnginePath

Character string that contains the path to the OCR engine files. Pass NULL to use the default path where the LEAD setup has installed the OCR engine files.

L_BOOL bUseThunk

Flag to determine to use thunk or not, possible values as follows:

Value Meaning
TRUE Use thunk in starting the OCR engine.
FALSE Don't use thunk in starting the OCR engine.

✎ NOTE

This parameter is obsolete for OmniPage engine for v19 or later since OmniPage engine now have support for Native x64 binaries. So whatever the value of this parameter was it will be ignored.

Returns

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

Comments

The L_Doc2StartUp function must be called before calling any other LEADTOOLS OCR document toolkit functions.

The user must unlock the OCR document toolkit using the L_SetLicenseFile function. If the OCR document toolkit is locked then the L_Doc2StartUp function will fail and will not initialize the OCR document toolkit.

This function will load and start the OCR document engine. When the handle to the OCR document is no longer needed, it should be freed by calling the L_Doc2ShutDown function. For every call to L_Doc2StartUp there must be an associated call to L_Doc2ShutDown function.

After starting up the engine, you should create setting collection by calling the L_Doc2CreateSettingsCollection function, and activate it by calling the L_Doc2SetActiveSettingsCollection function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2StartUpExample(L_TCHAR* pszSettingFile) 
{ 
   L_INT nRet ; 
   L_HDOC2 hDoc = NULL; 
 
   nRet = L_Doc2StartUp(&hDoc, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   L_INT nSId; 
   L_Doc2CreateSettingsCollection(hDoc, -1, &nSId); 
   L_Doc2SetActiveSettingsCollection(hDoc, nSId); 
 
   nRet = L_Doc2LoadSettings(hDoc, pszSettingFile); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   DOC2_FILLMETHOD fm; 
   nRet = L_Doc2GetFillMethod(hDoc, &fm); 
   if (nRet == SUCCESS) 
   { 
      if (fm != DOC2_FILL_HANDPRINT) 
      { 
         nRet = L_Doc2SetFillMethod(hDoc, DOC2_FILL_HANDPRINT); 
         if(nRet != SUCCESS) 
            return nRet; 
      } 
   } 
   else 
   { 
      return nRet; 
   } 
 
   nRet = L_Doc2SaveSettings (hDoc, pszSettingFile); 
   if (nRet == SUCCESS) 
      MessageBox(NULL, TEXT("The engine saved the updated settings to a file."), TEXT("Notice!"), MB_OK); 
   else 
   { 
      MessageBox(NULL, TEXT("The engine couldn't save the updated settings to a file."), TEXT("Error!"), MB_OK); 
      return nRet; 
   } 
 
   //... 
   //... 
   //... 
 
   L_Doc2DeleteSettingsCollection(hDoc, nSId); 
   nRet = L_Doc2ShutDown (&hDoc); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help