我在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