I am trying to create a simple sample in WPF using your OCR.net library. I am using .net 4.0 under Visual Studio 2012. The code seems to run fine until I get to actually running engine.process, where it hangs forever. I have tried multiple tiff/bmp files and the same thing always happens. Heres my code :
OcrEngine engine = new OcrEngine();
engine.Config.UseDefaultDictionaries = true;
string resFile = “C:\Temp\Aspose.OCR.Resources.zip”;
engine.Languages.AddLanguage(Aspose.OCR.Language.Load(“english”));
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.ShowDialog(this);
if (openFileDialog.FileName != null)
{
engine.Image = ImageStream.FromFile(openFileDialog.FileName);
try
{
using (engine.Resource = new FileStream(resFile, FileMode.Open))
{
try
{
// Get an instance of INotifier
INotifier processorWord = Notifier.Word();
// Write a delegate to handle the Elapsed event
processorWord.Elapsed += delegate
{
// Display the recognized text on screen
Console.WriteLine(processorWord.Text);
};
// Add the word processor to the OcrEngine
engine.AddNotifier(processorWord);
if (engine.Process())
{
string result = engine.Text.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
catch (Exception ex)
{
throw;
}
}