public IOcrLanguageManager LanguageManager { get; }
@property (nonatomic, strong, readonly) LTOcrLanguageManager *languageManager
public OcrLanguageManager getLanguageManager()
property IOcrLanguageManager^ LanguageManager {
IOcrLanguageManager^ get();
}
LanguageManager # get (IOcrEngine)
The instance of the IOcrLanguageManager object used to manage the language environment of the character sets.
The LanguageManager allows you to do the following:
For more information, refer to IOcrLanguageManager.
You must call the Startup method before you can use the LanguageManager.
Note: The LanguageManager state is also saved when the engine settings are saved. For more information, refer to IOcrSettingManager.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Ocr;
public void OcrLanguageManagerExample()
{
// Create an instance of the engine
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD))
{
// Start the engine using default parameters
ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir);
// Show languages supported by this engine
string[] supportedLanguages = ocrEngine.LanguageManager.GetSupportedLanguages();
Console.WriteLine("Supported languages:");
foreach (string supportedLanguage in supportedLanguages)
{
// Get the friendly name of this language using the .NET CultureInfo class
CultureInfo ci = new CultureInfo(supportedLanguage);
Console.WriteLine(" {0} ({1})", supportedLanguage, ci.EnglishName);
}
// Check if current culture info language is supported
CultureInfo currentCulture = CultureInfo.CurrentCulture;
string name = currentCulture.TwoLetterISOLanguageName;
bool supported = ocrEngine.LanguageManager.IsLanguageSupported(name);
if (!supported)
{
name = currentCulture.Name;
supported = ocrEngine.LanguageManager.IsLanguageSupported(name);
}
if (supported)
{
Console.WriteLine("Current culture is {0}, and it is supported by this OCR engine. Enabling only this language and German now", currentCulture.EnglishName);
ocrEngine.LanguageManager.EnableLanguages(new string[] { name, "de" });
// If this engine does not support enabling multiple languages (currently the LEADTOOLS Advantage OCR engine), then GetEnabledLanguages
// will always return an array of 1, make a note of this
if (!ocrEngine.LanguageManager.SupportsEnablingMultipleLanguages)
Console.WriteLine("This engine supports enabling only one language at a time, so only the first language we enabled will be used");
string[] enabledLanguages = ocrEngine.LanguageManager.GetEnabledLanguages();
Console.WriteLine("Current enabled languages in the engine are:");
foreach (string enabledLanguage in enabledLanguages)
{
// Get the friendly name of this language using the .NET CultureInfo class
CultureInfo ci = new CultureInfo(enabledLanguage);
Console.WriteLine(" {0} ({1})", enabledLanguage, ci.EnglishName);
}
}
else
Console.WriteLine("Current culture is {0}, and it is not supported by this OCR engine", currentCulture.EnglishName);
ocrEngine.Shutdown();
}
}
static class LEAD_VARS
{
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.