Progress® Telerik® Reporting R2 2017

Hide the print progress dialog when printing a report programmatically

To prevent the print UI from appearing, you should specify valid printer settings and a standard print controller to this method. This example illustrates how to prevent the print UI from appearing in a batch print operation or when printing from a service.

Note Note
This approach is only applicable for desktop applications (WPF, Windows Forms and etc.). If this code sample is used in server-client environment the print operation will be executed on the server side.
var reportName = "Telerik.Reporting.Examples.CSharp.Dashboard, CSharp.ReportLibrary";

// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings
    = new System.Drawing.Printing.PrinterSettings();

// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =
    new System.Drawing.Printing.StandardPrintController();

// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor
    = new Telerik.Reporting.Processing.ReportProcessor();

reportProcessor.PrintController = standardPrintController;

Telerik.Reporting.TypeReportSource typeReportSource =
    new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

reportProcessor.PrintReport(typeReportSource, printerSettings);

See Also