Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
System.Printing.PrintQueueException: PrintTicket provider failed to retrieve PrintCapabilities
posted

We're using the Report class to print the contents of a XamDataGrid, using a method within a subclass of XamDataGrid that basically looks like this:

Report report1 = new Report();
report1.Sections.Add(new EmbeddedVisualReportSection(this));
report1.Print();

This is working fine for all of our users except one, who is encountering the following exception in that code:

System.Printing.PrintQueueException: PrintTicket provider failed to retrieve PrintCapabilities. Win32 error: -2147467259

Here's the stack trace:

at MS.Internal.Printing.Configuration.PTProvider.GetPrintCapabilities(MemoryStream printTicket)
at System.Printing.PrintTicketManager.GetPrintCapabilitiesAsXml(PrintTicket printTicket)
at System.Printing.PrintTicketManager.GetPrintCapabilities(PrintTicket printTicket)
at System.Printing.PrintQueue.GetPrintCapabilities(PrintTicket printTicket)
at System.Windows.Controls.PrintDialog.UpdatePrintableAreaSize()
at System.Windows.Controls.PrintDialog.get_PrintableAreaWidth()
at Infragistics.Windows.Reporting.Report.UpdateSettingsFromPrintDialog(PrintDialog printDialog, Boolean dialogDisplayed)
at Infragistics.Windows.Reporting.Report.InitializeReport(Boolean showPrintDialog)
at Infragistics.Windows.Reporting.Report.Print(Boolean showPrintDialog, Boolean showReportProgressControl, FrameworkElement reportProgressControlOwnedElement)

This blog post http://petterisbetter.com/michael/index.php/2008/09/29/printticket-provider-failed-to-retrieve- has the following to say about this problem:

"If you do not specify your own PrintTicket for print operations, the default UserPrintTicket for the PrintQueue is used, and some print drivers fail to provide valid objects for the UserPrintTicket and DefaultPrintTicket by yielding the above exception. This is essentially a driver problem, but inevitably there will be instances where your software runs on drivers you didn't know about or in environments where driver upgrades may not be possible. Therefore, I recommend always forcing use of your own PrintTicket for all printing operations in WPF, as I did in the above code for the calls to GetPrintCapabilities and WriteAsync methods. Note that each of these methods has an overload that does not take a PrintTicket argument. These are the ones to avoid."

Is there an option for Report.Print() (or an alternative) that we can use to print the grid contents that uses a custom PrintTicket?

Thanks,
Jim Honeycutt

Parents Reply Children
No Data