L_Doc2GetSupportedLanguages

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetSupportedLanguages(hDoc, ppLangIds, pnLangCount)

L_HDOC2 hDoc;

/* handle to the OCR document */

DOC2_LANGIDS ** ppLangIds;

/* currently supported languages */

L_INT * pnLangCount;

/* number of the supported languages */

Gets a list of all the supported OCR languages according to the installed language files, inside the engine directory.

Parameter

Description

hDoc

Handle to the OCR document.

ppLangIds

Pointer to a DOC2_LANGIDS array to be updated with the currently supported languages.

pnLangCount

Pointer to an integer to be updated with the number of the supported languages in ppLangIds.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To activate the recognized languages, call the L_Doc2SelectLanguages function.

This function will allocate memory for ppLangIds. To free the ppLangIds parameter, call the L_Doc2FreeLanguages function.

To get the character options for the current activated languages, call the L_Doc2GetCharLangsOptions function.

To set the character options for the current activated languages, call the L_Doc2SetCharLangsOptions 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.

See Also

Functions:

L_Doc2GetLanguageFriendlyName, L_Doc2GetSelectedLanguages, L_Doc2SelectLanguages, L_Doc2FreeLanguages, L_Doc2SetCharLangsOptions, L_Doc2GetCharLangsOptions, L_Doc2GetDefaultSpellLanguages

Topics:

OCR Functions: Languages

 

Working with Languages

Example

L_LTDOC2TEX_API  L_INT Doc2GetSupportedLanguagesExample(L_HDOC2 hDoc)
{
   L_INT nRet;
   DOC2_LANGIDS * pLangIds = NULL;
   L_INT nLangCount = 0;


   L_TCHAR * pszLangName = NULL;


   L_INT nLength = 0;



   nRet = L_Doc2GetSupportedLanguages(hDoc, &pLangIds, &nLangCount);
   if (nRet != SUCCESS)
      return nRet;



   for (L_INT i=0; i<nLangCount; i++)
   {


      nRet = L_Doc2GetLanguageFriendlyName(hDoc, pLangIds[i], NULL, &nLength);


      if(nRet == SUCCESS)


      {


         pszLangName = (L_TCHAR*)GlobalAllocPtr(GHND, nLength * sizeof(L_TCHAR));


         if(pszLangName)


         {


            L_Doc2GetLanguageFriendlyName(m_hDoc, pLangIds[i], pszLangName, &nLength);


            MessageBox(NULL, pszLangName, TEXT("Notice!"), MB_OK);


         }


      }
   }
   nRet = L_Doc2FreeLanguages (hDoc, &pLangIds);
   return nRet;
}