Hello,
I’ve bought Aspose total Net license last week for parsing documents library.
Everything works fine so far (doc, xl, pdf) except for OCR.
Could you check my code and error message please?
Regards, Vadim.
Error log Extract:
13-03-05 09:51:33.0 : Error occurred during recognition.
13-03-05 09:51:33.0 : Error while loading 0 net (Network_12netsFS_Arial_BigAlphabet_18x18_8pt_468-26_v4L): Unable to find assembly 'Aspose.OCR, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
The code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aspose.OCR;
using System.IO;
public static string ParseFile(string fileName, byte[] buffer)
{
string fileExt = fileName.Substring(fileName.LastIndexOf('.') + 1).ToLower();
ImageStreamFormat format = ImageStreamFormat.Png;
const string resourceFileName = @"D:\Aspose\Aspose.OCR for .NET\Resource\Aspose.OCR.Resources.zip";
Aspose.OCR.OcrEngine ocr = new Aspose.OCR.OcrEngine();
ocr.Languages.AddLanguage(Language.Load("english"));
ocr.Config.NeedRotationCorrection = false;
ocr.Config.UseDefaultDictionaries = true;
System.IO.MemoryStream stream = new MemoryStream(buffer);
ocr.Image = ImageStream.FromMemoryStream(stream, format);
if (!File.Exists(resourceFileName))
return resourceFileName + " not found";
using (ocr.Resource = new FileStream(resourceFileName, FileMode.Open))
{
try
{
if (ocr.Process())
{
return ocr.Text.ToString();
}
}
catch (Exception ex)
{
addLog(ex.Message);
addLog(ex.InnerException.Message);
return ex.Message;
}
}
return "";
}