【发布时间】:2016-06-14 23:39:43
【问题描述】:
我正在使用 Windows 服务中的 Amyuni pdf 库,该服务作为 LocalSystem Account 运行。以下是我用于打印的代码。
private void Initialize()
{
acPDFCreatorLib.Initialize();
acPDFCreatorLib.SetLicenseKey(licenseTo, activationCode);
}
......打印pdf
using (FileStream file1 = new FileStream(fileName, FileMode.Open, FileAccess.Read))
using (IacDocument doc1 = new IacDocument())
{
doc1.Open(file1, "");
doc1.AttributeByName("Title").Value = documentName;
doc1.SetAttributeForMultipleSelection("UnicodeFonts", true, false);
doc1.Copies = printEvent.Copies;
bool printed = doc1.Print(printerName, false);
PrintSystemJobInfo PrintSystemJobInfo = GetPrintJob(printerName, fileName);
if (printed)
{
Logger.Log(string.Format("[AMYUNI] PDF' {0} ' printed using printer {1}", documentName, printerName));
return true;
}
return false;
}
对于某些打印机 'doc1.Print(printerName, false);'在不工作并且它没有返回结果。用于调用打印函数的线程永远不会返回。所以我们无法识别错误。
所以现在,我们计划的解决方案是在不同线程中为每台打印机初始化 amyuni 库实例。有了这个,我们将能够使我们的解决方案适用于其他打印机,即使它被单个打印机阻止(amyuni 库冻结不响应)。
对于这个我们如何初始化库的多个实例?
【问题讨论】:
标签: c# pdf printing pdf-generation