corelibraries-devexpress-dot-xtraprinting-68a071a5.md
Provides data for the PrintingSystemBase.StartPrint event.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public class PrintDocumentEventArgs :
EventArgs
Public Class PrintDocumentEventArgs
Inherits EventArgs
PrintDocumentEventArgs is the data class for the following events:
The PrintingSystemBase.StartPrint event is fired before the document returned by the PrintingSystemBase.Document property is printed. A PrintDocumentEventArgs specifies the PrintDocumentEventArgs.PrintDocument value which represents the document being printed, and its properties.
The following example demonstrates how to use the PrintDocumentEventArgs object when handling the PrintingSystemBase.StartPrint event. The example below demonstrates how to programmatically select a printer to print a document at runtime.
using System;
using System.Windows.Forms;
using System.Drawing.Printing;
using DevExpress.XtraPrinting;
using DevExpress.Utils;
// ...
// creating a PrintingSystem object
private PrintingSystem printingSystem1 = new PrintingSystem();
//...
private void button1_Click(object sender, System.EventArgs e) {
// handling the StartPrint event
printingSystem1.StartPrint += new PrintDocumentEventHandler(printingSystem_StartPrint);
// printing the document
printingSystem1.Print();
}
private void printingSystem_StartPrint(object sender, PrintDocumentEventArgs e) {
// setting the specific printer's name before printing
e.PrintDocument.PrinterSettings.PrinterName = PrinterSettings.InstalledPrinters[1];
}
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Printing
Imports DevExpress.XtraPrinting
Imports DevExpress.Utils
' ...
' creating a PrintingSystem object
Private WithEvents printingSystem1 As New PrintingSystem()
' ...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
' printing the document
printingSystem1.Print()
End Sub
' handling the StartPrint event
Private Sub printingSystem_StartPrint(ByVal sender As System.Object, _
ByVal e As PrintDocumentEventArgs) Handles printingSystem1.StartPrint
' setting the specific printer's name before printing
e.PrintDocument.PrinterSettings.PrinterName = PrinterSettings.InstalledPrinters(1)
End Sub
Object EventArgs PrintDocumentEventArgs
See Also