#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2SelectLanguages(hDoc, pLangIds, nLangCount)
L_HDOC2 hDoc; |
handle to the OCR document |
DOC2_LANGIDS * pLangIds; |
pointer to languages to be activated |
L_INT nLangCount; |
language count |
Activates the specified languages into the OCR document engine.
Parameter |
Description |
hDoc |
Handle to the OCR document. |
pLangIds |
Array of language ids that will be activated. |
nLangCount |
Number of language array elements in pLangIds. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Defines the main part of the Language environment of the Character Set.
If this function is not called to specify the language(s) to be recognized, the default value, the English language, is applied.
To get the currently supported languages, call the L_Doc2GetSupportedLanguages function.
To get the current activated languages, call the L_Doc2GetSelectedLanguages function.
To get the character options for the current activated languages, call the L_Doc2GetCharLangsOptions function.
To recognize page or set of pages, call the L_Doc2Recognize function.
Required DLLs and Libraries
LTDOC2 For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
L_INT Doc2SelectLanguagesExample(L_HDOC2 hDoc)
{
L_INT nRet;
CHAROPTIONS2 CharOpts;
DOC2_LANGIDS SelLangs[1];
SelLangs[0] = DOC2_LANG_ID_ENGLISH;
nRet = L_Doc2SelectLanguages(hDoc, SelLangs, 1);
if (nRet != SUCCESS)
{
MessageBox(NULL, TEXT("Couldn't set English as the default language."), TEXT("Error!"), MB_OK);
return nRet;
}
ZeroMemory(&CharOpts, sizeof(CHAROPTIONS2));
nRet = L_Doc2GetCharLangsOptions(hDoc, &CharOpts, sizeof(CHAROPTIONS2));
if(nRet != SUCCESS)
return nRet;
if (CharOpts.CharFilter != DOC2_ZONE_CHAR_FILTER_ALL)
CharOpts.CharFilter = DOC2_ZONE_CHAR_FILTER_ALL;
nRet = L_Doc2SetCharLangsOptions (hDoc, &CharOpts);
if(nRet != SUCCESS)
return nRet;
if (CharOpts.pszCharFilterPlus)
GlobalFreePtr(CharOpts.pszCharFilterPlus);
if (CharOpts.pszCharPlus)
GlobalFreePtr(CharOpts.pszCharPlus);
return SUCCESS;
}