Note that there are some explanatory texts on larger screens.

plurals
  1. POReportViewer.PrintDialog() throws exception when printing to Adobe PDF
    text
    copied!<p>I am working on a WinForms app that uses the <code>ReportViewer</code> control to show a few Reporting Services reports. On these screens, we allow the user to print the report by calling the <code>PrintDialog()</code> method on the ReportViewer like so:</p> <pre><code>_reportViewer.PrintDialog(); </code></pre> <p>This works fine in most cases, it brings up the standard windows print dialog, the user chooses what printer they want to print to, and it prints. However, when the user chooses to print to PDF using "Adobe PDF", it throws a <code>Win32Exception: The specified datatype is invalid</code>. The file dialog to choose where to save the pdf doesn't even come up.</p> <p>This only happens with Adobe PDF printer. I installed <a href="http://www.nitropdf.com/" rel="nofollow">NitroPDF</a> and used their PDF printer and it works without a problem.</p> <p>Does anybody have an idea on what could be causing this to happen?</p> <p><strong>Edit:</strong></p> <p>Here is the stack trace:</p> <pre><code>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() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload