I am working on a WinForms application that uses a ReportViewer control to display several Reporting Services reports. On these screens, we allow the user to print the report by calling the PrintDialog() method in ReportViewer as follows:
_reportViewer.PrintDialog();
In most cases, this works great, it displays the standard Windows print dialog, the user selects which printer they want to print, and prints. However, when the user selects PDF printing using "Adobe PDF", he throws a Win32Exception: The specified datatype is invalid . The file dialog box to choose where to save the pdf file does not even appear.
This only happens with an Adobe PDF printer. I installed NitroPDF and used their PDF printer and it works without problems.
Does anyone have an idea on what could be causing this?
Edit:
Here is the stack trace:
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()
source share