-2
即時通訊。即時通訊使用nuance omnipage OCR SDK即時通訊內容OCR SDK Engine.SetLicenseKey()
編譯時出現錯誤:引擎初始化錯誤或沒有適當的許可證。我發現可能我應該使用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」); 在這裏我得到一個錯誤 – Nemo
@SimonPrice,添加源代碼 – Nemo