GdPicture.NET.14
GdPicture14 Namespace / GdPictureOCR Class / AddLanguage Method
A member of the OCRLanguage enumeration. A new language, that is added in the current GdPictureOCR object for subsequent use together with the previously added languages.
Example





In This Topic
AddLanguage Method (GdPictureOCR)
In This Topic
Adds a known language from the defined resource folder to be used during subsequent OCR processes. You are able to add multiple languages by calling this method for each language according to your preference. The specified language is then added internally in the current GdPictureOCR object.
Syntax
'Declaration
 
Public Function AddLanguage( _
   ByVal Language As OCRLanguage _
) As GdPictureStatus
public GdPictureStatus AddLanguage( 
   OCRLanguage Language
)
public function AddLanguage( 
    Language: OCRLanguage
): GdPictureStatus; 
public function AddLanguage( 
   Language : OCRLanguage
) : GdPictureStatus;
public: GdPictureStatus AddLanguage( 
   OCRLanguage Language
) 
public:
GdPictureStatus AddLanguage( 
   OCRLanguage Language
) 

Parameters

Language
A member of the OCRLanguage enumeration. A new language, that is added in the current GdPictureOCR object for subsequent use together with the previously added languages.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
Please ensure that the language dictionary file for the required language is located in the currently defined resource folder. You can find these files within your standard installation usually in the directory @\GdPicture.Net 14\redist\OCR or you can download additional language dictionary files here.
Example
How to add multiple languages to be used by OCR.
Dim caption As String = "Example: AddLanguage"
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    'Specify your resource folder for OCR dictionaries.
    gdpictureOCR.ResourcesFolder = "\GdPicture.Net 14\redist\OCR"
    'To add the english, the german and the french language, do the following:
    If (gdpictureOCR.AddLanguage(OCRLanguage.English) = GdPictureStatus.OK) AndAlso
       (gdpictureOCR.AddLanguage(OCRLanguage.German) = GdPictureStatus.OK) AndAlso
       (gdpictureOCR.AddLanguage(OCRLanguage.French) = GdPictureStatus.OK) Then
        'You can do your another stuff with gdpictureOCR here.
    Else
        MessageBox.Show("The AddLanguage() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
    End If
End Using
string caption = "Example: AddLanguage";
using (GdPictureOCR gdpictureOCR = new GdPictureOCR())
{
    //Specify your resource folder for OCR dictionaries.
    gdpictureOCR.ResourcesFolder = "\\GdPicture.Net 14\\redist\\OCR";
 
    //To add the english, the german and the french language, do the following:
    if ((gdpictureOCR.AddLanguage(OCRLanguage.English) == GdPictureStatus.OK) &&
        (gdpictureOCR.AddLanguage(OCRLanguage.German) == GdPictureStatus.OK) &&
        (gdpictureOCR.AddLanguage(OCRLanguage.French) == GdPictureStatus.OK))
    {
        //You can do your another stuff with gdpictureOCR here.
    }
    else
    {
        MessageBox.Show("The AddLanguage() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
    }
}
See Also