L_DocStartUp

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocStartUp(phDoc, pszEnginePath)

L_HDOC * phDoc;

/* pointer to document handle to be updated */

L_TCHAR * pszEnginePath;

/* OCR engine location */

Starts the OCR document engine and initializes the handle.

Parameter

Description

phDoc

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

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

L_DocStartUp must be called before calling any other LEADTOOLS OCR document toolkit functions.

The user must unlock the OCR document toolkit using the L_UnlockSupport function. If the OCR document toolkit is locked then the L_DocStartUp 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 L_DocShutDown. For every call to L_DocStartUp there must be an associated call to L_DocShutDown.

Required DLLs and Libraries

LTDOC

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_DocShutDown

Topics:

OCR Functions: Starting and Shutting Down

 

Starting and Shutting Down the Engine

Example


 L_INT DocStartUpExample(L_TCHAR* pszSettingFile)
{
   L_INT nRet ;
   L_HDOC hDoc = NULL;

   nRet = L_DocStartUp(&hDoc, NULL);
   if (nRet != SUCCESS)
      return nRet;

   /* Unlock OCR support.
      Note that this is a sample key, which will not work in your toolkit. */
   L_UnlockSupport(L_SUPPORT_OCR, L_KEY_OCR);
   
   nRet = L_DocLoadSettings(hDoc, pszSettingFile);
   if(nRet != SUCCESS)
      return nRet;

   FILLMETHOD fm;
   nRet = L_DocGetFillMethod(hDoc, &fm);
   if (nRet == SUCCESS)
   {
      if (fm != FILL_HANDPRINT)
      {
         nRet = L_DocSetFillMethod(hDoc, FILL_HANDPRINT);
         if(nRet != SUCCESS)
            return nRet;
      }
   }
   else
   {
      return nRet;
   }

   nRet = L_DocSaveSettings (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;
   }

   nRet = L_DocShutDown (&hDoc);
   if(nRet != SUCCESS)
      return nRet;

   return SUCCESS;

}