Dim caption As String = "Example: GetAvailableLanguage"
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
'Specify your resource folder for OCR dictionaries.
gdpictureOCR.ResourcesFolder = "\GdPicture.Net 14\redist\OCR"
Dim count As Integer = gdpictureOCR.GetAvailableLanguageCount()
If gdpictureOCR.GetStat() = GdPictureStatus.OK Then
If count > 0 Then
Dim lang As OCRLanguage = 0
Dim found As Boolean = False
For idx As Integer = 0 To count - 1
lang = gdpictureOCR.GetAvailableLanguage(idx)
If gdpictureOCR.GetStat() = GdPictureStatus.OK Then
found = (lang = OCRLanguage.English)
If found Then Exit For
Else
MessageBox.Show("The GetAvailableLanguage() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
Exit For
End If
Next
If gdpictureOCR.GetStat() = GdPictureStatus.OK Then MessageBox.Show("The number of available languages: " + count.ToString() + vbCrLf + "English: " + found.ToString(), caption)
Else
MessageBox.Show("No languages are available in this resource folder: " + gdpictureOCR.ResourcesFolder, caption)
End If
Else
MessageBox.Show("The GetAvailableLanguageCount() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
End If
End Using
string caption = "Example: GetAvailableLanguage";
using (GdPictureOCR gdpictureOCR = new GdPictureOCR())
{
//Specify your resource folder for OCR dictionaries.
gdpictureOCR.ResourcesFolder = "\\GdPicture.Net 14\\redist\\OCR";
int count = gdpictureOCR.GetAvailableLanguageCount();
if (gdpictureOCR.GetStat() == GdPictureStatus.OK)
{
if (count > 0)
{
OCRLanguage lang = 0;
Boolean found = false;
for (int idx = 0; idx < count; idx++)
{
lang = gdpictureOCR.GetAvailableLanguage(idx);
if (gdpictureOCR.GetStat() == GdPictureStatus.OK)
{
found = (lang == OCRLanguage.English);
if (found) break;
}
else
{
MessageBox.Show("The GetAvailableLanguage() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
break;
}
}
if (gdpictureOCR.GetStat() == GdPictureStatus.OK)
MessageBox.Show("The number of available languages: " + count.ToString() + "\nEnglish: " + found.ToString(), caption);
}
else
MessageBox.Show("No languages are available in this resource folder: " + gdpictureOCR.ResourcesFolder, caption);
}
else
MessageBox.Show("The GetAvailableLanguageCount() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
}