Manage the Print Progress
- 2 minutes to read
Handle the following events to track the printing progress and change the printing settings at runtime:
-
This event occurs before document pages are sent to a printer. You can obtain information about the current printing progress and access the current page index and other page settings in the event handler.
Handle this event to perform any specific operations before printing each page, for instance, reflect the current printing state using the ProgressBarEdit control. You can also use the PrintProgressEventArgs.PageSettings property to change a printed page’s settings as shown below.
using DevExpress.XtraPrinting; using DevExpress.Xpf.Printing; // ... private void simpleButton_Click(object sender, RoutedEventArgs e) { XtraReport1 report = new XtraReport1(); report.PrintProgress += Report_PrintProgress; PrintHelper.Print(report); } private void Report_PrintProgress(object sender, PrintProgressEventArgs e) { if (e.PageIndex == 1) e.PageSettings.Landscape = true; }
-
This event occurs only once - after one of the following actions (before sending a document to a printer):
- calling the PrintHelper.PrintDirect method;
- clicking the Quick Print button in the Document Preview.
- clicking OK in the Print dialog (called either using the PrintHelper.Print method or the Print command in the Document Preview).
The following tutorials demonstrate how to use this event to perform different tasks: