Back to Devexpress

Specify the Number of Copies to Print

xtrareports-400020-desktop-reporting-common-features-printing-print-reports-in-wpf-specify-the-number-of-copies-to-print.md

latest1.7 KB
Original Source

Specify the Number of Copies to Print

  • Aug 18, 2023

This example demonstrates how to specify how many copies of a document to print.

Handle the PrintingSystemBase.StartPrint event using the XtraReport.PrintingSystem property. In the event handler, access the PrinterSettings object using the event argument’s PrintDocument property and define the number of copies.

csharp
using DevExpress.Xpf.Printing;
using DevExpress.XtraPrinting;
// ... 

private void simpleButton_Click(object sender, RoutedEventArgs e) {
    XtraReport1 report = new XtraReport1();
    report.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
    PrintHelper.Print(report);
}

private void PrintingSystem_StartPrint(object sender, PrintDocumentEventArgs e) {
    // Set the number of document copies to print.
    e.PrintDocument.PrinterSettings.Copies = 3;
}
vb
Imports DevExpress.Xpf.Printing
Imports DevExpress.XtraPrinting
' ...

Private Sub simpleButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim report As XtraReport1 = New XtraReport1()
    report.PrintingSystem.StartPrint += PrintingSystem_StartPrint
    PrintHelper.Print(report)
End Sub

Private Sub PrintingSystem_StartPrint(ByVal sender As Object, ByVal e As PrintDocumentEventArgs)
    ' Set the number of document copies to print.
    e.PrintDocument.PrinterSettings.Copies = 3
End Sub