L_OcrEngine_GetLanguageManager

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrEngine_GetLanguageManager(engine, languageManager)

L_OcrEngine engine; handle to the OCR engine
L_OcrLanguageManager* languageManager; pointer to L_OcrLanguageManager handle to be updated

Returns a handle to the OCR engine language manager.

Parameter Description
engine Handle to the OCR engine.
languageManager Pointer to a L_OcrLanguageManager handle to be updated.

Returns

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

Comments

This function returns a handle to the OCR engine language manager where you get access to the language environment of the character sets used by this OCR engine.

The L_OcrLanguageManager allows you to do the following:

Required DLLs and Libraries

LTOCR
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_OcrEngineManager_CreateEngine, L_OcrEngine_Startup, L_OcrEngine_Shutdown, L_OcrEngine_Destroy, L_OcrEngine_GetEngineType, L_OcrEngine_IsStarted, L_OcrEngine_GetSettingManager, L_OcrEngine_GetSpellCheckManager, L_OcrEngine_GetZoneManager, L_OcrEngine_GetDocumentManager, L_OcrEngine_GetAutoRecognizeManager, L_OcrEngine_GetWorkDirectory, L_OcrEngine_GetEngineDirectory
Topics: Programming with LEADTOOLS OCR Advantage
Starting and Shutting Down the OCR Engine
LEADTOOLS OCR Advantage Engine Settings

Example

#define OCR_ADVANTAGE_RUNTIME_DIR TEXT("C:\\LEADTOOLS 19\\Bin\\Common\\OcrAdvantageRuntime") 
L_INT L_OcrEngine_GetLanguageManagerExample() 
{ 
   L_OcrEngine ocrEngine = NULL; 
   L_OcrLanguageManager languageManager = NULL; 
   L_OcrLanguage* supportedLanguages = NULL; 
   L_OcrLanguage* additionalLanguages = NULL; 
   L_OcrLanguage* enabledLanguages = NULL; 
   L_UINT languageCount = 0; 
   // Create an instance of the engine 
   L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine); 
   // Start the engine using default parameters 
   L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR); 
   // Get the OCR Language Manager 
   L_OcrEngine_GetLanguageManager(ocrEngine, &languageManager); 
   // Show languages supported by this engine 
   L_OcrLanguageManager_GetSupportedLanguages(languageManager, &supportedLanguages, &languageCount); 
   std::cout << "Supported languages (" << languageCount << "):\n"; 
   for(L_UINT index = 0; index < languageCount; index++) 
   { 
      // Print the language name of this language 
      L_TCHAR szLanguageName[20]; 
      L_OcrLanguageManager_GetLanguageName(supportedLanguages[index], szLanguageName, _countof(szLanguageName)); 
      std::cout << szLanguageName << std::endl; 
   } 
   // free supportedLanguages 
   L_OcrMemory_Free(supportedLanguages); 
   // Show engine additional supported languages that you might want to download and use 
   L_UINT additionalLanguagesCount = 0; 
   L_OcrLanguageManager_GetAdditionalLanguages(languageManager, &additionalLanguages, &additionalLanguagesCount); 
   std::cout << "Additional languages (" << additionalLanguagesCount << "):\n"; 
   for(L_UINT index = 0; index < additionalLanguagesCount; index++) 
   { 
      // Print the language name of this language 
      L_TCHAR szLanguageName[20]; 
      L_OcrLanguageManager_GetLanguageName(additionalLanguages[index], szLanguageName, _countof(szLanguageName)); 
      std::cout << szLanguageName << std::endl; 
   } 
   // free additionalLanguages 
   L_OcrMemory_Free(additionalLanguages); 
   // Show enabled languages by this engine 
   L_OcrLanguageManager_GetEnabledLanguages(languageManager, &enabledLanguages, &languageCount); 
   std::cout << std::endl; 
   std::cout << "Enabled languages (" << languageCount << "):\n"; 
   for(L_UINT index = 0; index < languageCount; index++) 
   { 
      // Print the language name of this language 
      L_TCHAR szLanguageName[20]; 
      L_OcrLanguageManager_GetLanguageName(supportedLanguages[index], szLanguageName, _countof(szLanguageName)); 
      std::cout << szLanguageName << std::endl; 
      // If you have the language name and wish to get its values you can call the below function: 
      L_OcrLanguage languageValue = L_OcrLanguage_None; 
      L_OcrLanguageManager_GetLanguageValue(szLanguageName, &languageValue); 
   } 
   // Try to enable the English language 
   L_INT ret = L_OcrLanguageManager_IsLanguageSupported(languageManager, L_OcrLanguage_EN); 
   if(ret == SUCCESS) 
   { 
      L_OcrLanguage languagesToEnable[1] = { L_OcrLanguage_EN }; 
      L_OcrLanguageManager_EnableLanguages(languageManager, languagesToEnable, 1); 
   } 
   // Do the rest of your stuff here, Load image, recognize and save 
   // free enabledLanguages 
   L_OcrMemory_Free(enabledLanguages); 
   //CLEANUP 
   L_OcrEngine_Destroy(ocrEngine); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Advantage OCR C API Help