Reporting

Prints a report document using the specified printer settings.

Namespace: Telerik.Reporting.Processing
Assembly: Telerik.Reporting (in Telerik.Reporting.dll)

Syntax

C#
public void PrintReport(
	ReportSource reportSource,
	PrinterSettings printerSettings
)
Visual Basic
Public Sub PrintReport ( _
	reportSource As ReportSource, _
	printerSettings As PrinterSettings _
)

Parameters

reportSource
Type: Telerik.Reporting..::..ReportSource
Specifies the ReportSource for the report document to print.
printerSettings
Type: System.Drawing.Printing..::..PrinterSettings
Specifies the printer settings to be used when printing the document. If null or invalid settings are specified, the Print Dialog appears.

Remarks

To prevent the Print Dialog from appearing, you should specify valid printer settings to this method.

Examples

This example illustrates how to prevent the standard Print Dialog from appearing in a batch print operation or when printing from a service.
CopyC#
Telerik.Reporting.IReportDocument myReport = new MyReport();

// 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.InstanceReportSource instanceReportSource =
    new Telerik.Reporting.InstanceReportSource();

instanceReportSource.ReportDocument = myReport;

reportProcessor.PrintReport(instanceReportSource, printerSettings);
CopyVB.NET
Dim report1 As New MyReport

' Obtain the settings of the default printer
Dim printerSettings As New System.Drawing.Printing.PrinterSettings

' The standard print controller comes with no UI
Dim standardPrintController As New System.Drawing.Printing.StandardPrintController

' Create an instance report source to pass the report to the report processor
Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
instanceReportSource.ReportDocument = report1

' Print the report using the custom print controller
Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor
reportProcessor.PrintController = standardPrintController
reportProcessor.PrintReport(instanceReportSource, printerSettings)

Version Information

Supported in: 1.0.1

See Also