Skip to main content

XtraReport.DefaultPrinterSettingsUsing Property

Provides access to an object that defines which of the system’s default printer settings should be used when printing an XtraReport.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatPageSettings)]
public PrinterSettingsUsing DefaultPrinterSettingsUsing { get; }

Property Value

Type Description
PrinterSettingsUsing

A PrinterSettingsUsing object, specifying which of the default printer’s settings should be used by this XtraReport object.

Remarks

Use the DefaultPrinterSettingsUsing property to make the report document use the settings defined by the default system printer.

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");
}
See Also