L_DocStartUp

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocStartUp(phDoc)

L_HDOC * phDoc;

/* pointer to document handle to be updated */

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.

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_HDOC hDoc;

L_INT TestOCR(L_TCHAR L_FAR * pszSettingFile)
{
   L_INT nRet = SUCCESS;

   nRet = L_DocStartUp(&hDoc);
   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, TEXT("TestKey"));

   L_DocLoadSettings(hDoc, pszSettingFile);

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

   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);

   L_DocShutDown (&hDoc);
   return SUCCESS;
}