我在Visual Studio 2010中使用Crystal Reports版本13。我有一台运行Windows 2012的打印服务器。我在运行时动态设置打印机,因为我有报告可以打印的30台打印机。所有这些打印机都在打印服务器上配置。为什么Crystal Reports PrintToPrinter方法很慢
PrintDocument pDoc = new PrintDocument();
PrintLayoutSettings PrintLayout = new PrintLayoutSettings();
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = pq.printerName;
PageSettings pSettings = new PageSettings(printerSettings);
crReportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;
crReportDocument.PrintOptions.PrinterDuplex = PrinterDuplex.Simplex;
OnMessageLogged(TraceEventType.Information, "PrePrint " + crReportDocument.PrintOptions.PrinterName);
WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(IntPtr.Zero);
try
{
crReportDocument.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);
OnMessageLogged(TraceEventType.Information, "Printed " + pq.printerName);
}
catch (Exception eprint)
{
OnMessageLogged(TraceEventType.Information, "****Failed to Print** to printer " + pq.printerName + " Exception " + eprint.ToString());
}
finally
{
// Resume impersonation
ctx.Undo();
OnMessageLogged(TraceEventType.Information, "Success Printing to " + pq.printerName);
}
当我调用PrintToPrinter方法:
crReportDocument.PrintToPrinter(printerSettings,pSettings,假,PrintLayout);
执行需要花费两分半钟的时间。无论我在Visual Studio中运行代码还是在服务器上部署服务,我都会看到这种行为。
我们最近将我们的服务服务器和我们的打印服务器升级到了Windows 2012.之前,我们的服务服务器是Windows 2008,而我们的打印服务器是Windows 2003.我们没有设置这个问题。
有没有人在打印到打印机需要很长时间或打印到Win2012打印服务器时遇到问题?
谢谢?
,当我使用上面的线,我得到clientdoc.iscdreportcleintdocument不包含“PrintOutputController定义'并且没有扩展方法'PrintOutputController'接受参数错误。你能帮忙吗? – Ameena
您是否使用正确版本的运行时?该属性是版本13.请参阅http://scn.sap.com/docs/DOC-7824 – reckface