我正在使用 Leadtools OCR
我引用了以下 DLLS:
Leadtools.dll
Leadtools.Barcode.oneD.dll
Leadtools.codecs.dll
Leadtools.codecs.fax.dll
Leadtools.codecs.png.dll
Leadtools.codecs.tif.dll
Leadtools.Forms.DocumentWriters.dll
Leadtools.forms.ocr.dll
Leadtools.forms.ocr.Advantage.dll
以下代码将Png文件转换为Pdf
private void button1_Click(object sender, EventArgs e)
{
try
{
string sourceFile = @"C:\Users\cf\Desktop\OcrTest\Images\Capture.PNG";
string targetFile = Path.ChangeExtension(sourceFile, "pdf");
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
{
ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime");
ocrEngine.AutoRecognizeManager.Run(sourceFile, targetFile, Leadtools.Forms.DocumentWriters.DocumentFormat.Pdf, null, null);
Process.Start(targetFile);
}
}
catch (OcrSupportLockedException ex)
{
Console.WriteLine("Support is locked. You need to unlock '{0}' in this engine to use this feature", ex.SupportType);
}
catch (OcrException ex)
{
Console.WriteLine("OCR Error\nCode: {0}\nMessage:{1}", ex.Code, ex.Message);
}
catch (RasterException ex)
{
Console.WriteLine("LEADTOOLS Error\nCode: {0}\nMessage:{1}", ex.Code, ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("System Error\nMessage:{0}", ex.Message);
}
}
以下行返回一个OcrException
Ocr Not Enabled
使用代码:-1760
我无法弄清楚为什么会这样
任何帮助,将不胜感激