我正在开发一个WinForms应用程序,使用ReportViewer
控件显示一些Reporting Services报告。在这些屏幕上,我们允许用户通过调用ReportViewer的PrintDialog()
方法来打印报告,如下所示:
_reportViewer.PrintDialog();
在大多数情况下,这个功能都很好用,它会弹出标准的Windows打印对话框,用户选择要打印到哪个打印机,然后就可以打印了。但是,当用户选择使用“Adobe PDF”打印PDF时,它会抛出一个
Win32Exception:指定的数据类型无效
。甚至不会弹出选择保存PDF文件的对话框。只有使用Adobe PDF打印机才会出现这种情况��我安装了NitroPDF并使用他们的PDF打印机,没有任何问题。
有人知道是什么原因导致这种情况发生吗?
编辑:
以下是堆栈跟踪信息:
at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Microsoft.Reporting.WinForms.ReportViewer.PrintDialog(PrinterSettings printerSettings)
at Microsoft.Reporting.WinForms.ReportViewer.PrintDialog()