【发布时间】:2016-02-05 15:51:39
【问题描述】:
我正在使用细微差别的全页面 OCR SDK。
编译时出错:引擎初始化错误,或没有适当的许可证。我发现可能我应该使用 Engine.SetLicenseKey() 方法。
我应该向 Engine.SetLicenseKey() 提供什么文件和许可证密钥?
try
{
List<OCR_Error> ocrErrors = new List<OCR_Error>();
System.Console.Write("** Title: Nuance Capture Development System CSharp Sample01 Application **\n");
System.Console.Write("Initializing the ENGine -- Engine.Init\n");
Engine.SetLicenseKey("licenseFile.lcx", "licenseKey");
Engine.Init("companyName", "projectName");
if (Engine.RECERR == RECERR.API_INIT_WARN)
{
ocrErrors.Add(new OCR_Error()
{
Message = "Module initialization warning. One or more recognition modules haven't been initialized properly.",
InnerMessage = "For more information, see Engine.ModulesInfo"
});
return;
}
string inputFileName = @"D:\3141864.pdf";
string inputFilePath = Path.GetFullPath(inputFileName);
string outputFilePath = inputFilePath.Replace('.', '_') + @".pdf";
if (File.Exists(outputFilePath))
File.Delete(outputFilePath);
File.Create(outputFilePath);
using (SettingCollection settings = new SettingCollection())
{
using (Document doc = new Document(inputFilePath))
{
int sourcePagesCount = doc.PageCount;
for (int i = 0; i < sourcePagesCount; i++)
{
using (Page page = new Page(inputFilePath, i, settings))
{
page.Preprocess();
page.Recognize();
using (Document oputputDocument = new Document(outputFilePath, 0, settings))
{
oputputDocument.InsertPage(page, i);
oputputDocument.Save(outputFilePath);
}
}
}
}
}
}
catch (Exception e)
{
System.Console.Write(e.Message);//Error: License Manager error.
}
finally
{
System.Console.Write("Free all resources allocated by the Engine -- Engine.ForceQuit\n");
Engine.ForceQuit();
System.Console.Write("End of Sample01 application\n");
System.Console.ReadKey();
}
【问题讨论】:
-
请分享您遇到错误的代码,以便我们为您提供帮助
-
@SimonPrice, Engine.Init("companyName", "projectName");在这里我得到一个错误
-
@SimonPrice,添加源代码