Back to Devexpress

XtraReportPreviewExtensions.Print(IReport, String) Method

windowsforms-devexpress-dot-xtrareports-dot-ui-dot-xtrareportpreviewextensions-dot-print-x28-devexpress-dot-xtrareports-dot-ireport-system-dot-string-x29.md

latest3.0 KB
Original Source

XtraReportPreviewExtensions.Print(IReport, String) Method

Prints the report document on the specified printer.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraPrinting.v25.2.dll

NuGet Package : DevExpress.Win.Printing

Declaration

csharp
public static void Print(
    this IReport report,
    string printerName
)
vb
<ExtensionAttribute>
Public Shared Sub Print(
    report As IReport,
    printerName As String
)

Parameters

NameTypeDescription
reportIReport

An object implementing the IReport interface.

| | printerName | String |

A String object that specifies the name of the printer on which the current document should be printed.

|

Remarks

Call the Print method to immediately send a report to the specified printer.

To be able to use this method, you should add the DevExpress.XtraPrinting.v25.2.dll to your project’s References list.

csharp
using DevExpress.XtraReports.UI;
// ...

XtraReport1 report = new XtraReport1();
report.Print("MyPrinterName");
vb
Imports DevExpress.XtraReports.UI
' ...

Dim report As XtraReport1 = New XtraReport1
report.Print("MyPrinterName")

If a printer with the specified name is not found, this method throws an InvalidPrinterException.

We recommend you use the ReportPrintTool class instead, which provides the similar PrintToolBase.Print method. This class also enables you to release the memory right after printing (for instance, by calling the Dispose method or utilizing the using statement).

Note

You cannot use the Print method in Web applications. Use the Web Document Viewer instead.

See Also

XtraReportPreviewExtensions Class

XtraReportPreviewExtensions Members

DevExpress.XtraReports.UI Namespace