小编ess*_*dbl的帖子

为什么 Crystal Reports PrintToPrinter 方法这么慢

我正在使用 Visual Studio 2010 内部的 Crystal Reports 版本 13。我有一台运行 Windows 2012 的打印服务器。我在运行时动态设置打印机,因为我有大约 30 台打印机可以发送报表。所有这些打印机都在打印服务器上进行配置。

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 …
Run Code Online (Sandbox Code Playgroud)

c# printing crystal-reports

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

crystal-reports ×1

printing ×1