Click or drag to resize
TesseractOcrEngine Constructor (String, String)
Initializes a new instance of the TesseractOcrEngine class.

Namespace: DevScope.Ocr.Tesseract.WindowsPhone
Assembly: DevScope.Ocr.Tesseract.WindowsPhone (in DevScope.Ocr.Tesseract.WindowsPhone.dll) Version: 255.255.255.255
Syntax
public TesseractOcrEngine(
	string tessdataRootPath,
	string lang
)

Parameters

tessdataRootPath
Type: SystemString
The dataPath must be the name of the parent directory of tessdata and must end in '\'.
lang
Type: SystemString
The language to use (language dictionary first 3 chars).
Examples
This sample shows how to instantiate and call the DoOcrAsync method.
void RunOcrEngine(...)  
{ 
   ... 
   var ocrEngine = new TesseractOcrEngine(tessdataRootFolder.Path, languageCode);

   // Create the ocr job request
   var request = new TesseractOcrJobRequest
   {
       JobName = "MyJob " + DateTime.Now.ToString()
   };

   // Create the doOcr operation by specifiying a filename that holds the image 
   var operationDoOcr = ocrEngine.DoOcrAsync(request, CommonSettings.FileNameFullResImageSentToOcr);


   // now, run the ocr and get the results
   var jobResponse = await operationDoOcr;

   // handle the results accordingly
   switch (jobResponse.Status)
   {
        case TesseractOcrResultStatus.Error:
        {
            MessageBox.Show(_ocrJobResponse.ErrorMessage, "Ocr Error", MessageBoxButton.OK);
            break;
        }
        case TesseractOcrResultStatus.InvalidLicense:
        {
            MessageBox.Show("INVALID LICENSE. Please contact Devscope Support.", "Ocr Error", MessageBoxButton.OK);
            break;
        }
        case TesseractOcrResultStatus.Ok:
        {
            textOcr.Text = jobResponse.Text;
            break;
        }
   }
}
See Also