Skip to main content

PageSettingsHelper Class

Enables you to override the default printer settings in your application.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v23.2.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public class PageSettingsHelper

The following members return PageSettingsHelper objects:

Remarks

To make the report document use the settings defined by the default system printer, use the XtraReport.DefaultPrinterSettingsUsing property.

These settings include the PrinterSettingsUsing.UseLandscape or PrinterSettingsUsing.UsePaperKind properties that define whether or not the XtraReport.Landscape and XtraReport.PaperKind properties of a report should be taken into account. When the printer’s settings are used, the values of the corresponding report properties will be ignored.

To override the default printer settings in your application, use the static properties and methods of the PageSettingsHelper class.

To assign the page margins defined for a specific printer to the XtraReport.Margins property of a report, use the approach illustrated in the following example.

using System.Drawing;
using System.Drawing.Printing;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    XtraReport1 report = new XtraReport1();
    PrinterSettings printerSettings = new PrinterSettings(); 

    // Specify the PrinterName if the target printer is not the default one.
    printerSettings.PrinterName = "Printer Name";

    // Assign minimum margins supported for the selected printer to the report document.
    report.Margins = PageSettingsHelper.GetMinMargins(printerSettings.DefaultPageSettings);

    // Send the report to the specified printer.
    ReportPrintTool printTool = new ReportPrintTool(report);
    printTool.Print("Printer Name");
}

Inheritance

Object
PageSettingsHelper
See Also