Skip to main content

IPrintControl.PrintingSystem Property

Specifies the Printing System used to create and print a document for the link associated with the IPrintControl.

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

PrintingSystemBase PrintingSystem { get; }

Property Value

Type Description
PrintingSystemBase

A PrintingSystemBase descendant.

Example

This example illustrates how to override Printing System commands in code.

using System;
using System.Windows.Forms;
using System.Drawing.Imaging;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
private void button1_Click(object sender, EventArgs e) {

    // Create a report instance, assigned to a Print Tool.
    ReportPrintTool pt = new ReportPrintTool(new XtraReport1());

    // Generate the report's document. This step is required
    // to activate its PrintingSystem and access it later.
    pt.Report.CreateDocument(false);

    // Override the ExportGraphic command.
    pt.PrintingSystem.AddCommandHandler(new ExportToImageCommandHandler());

    // Show the report's print preview.
    pt.ShowPreview();

}

public class ExportToImageCommandHandler : ICommandHandler {
    public virtual void HandleCommand(PrintingSystemCommand command,
    object[] args, IPrintControl printControl, ref bool handled) {
        if (!CanHandleCommand(command, printControl)) return;

        // Export the document to png.
        printControl.PrintingSystem.ExportToImage("C:\\Report.png", ImageFormat.Png);

        // Set handled to 'true' to prevent the standard exporting procedure from being called.
        handled = true;
    }

    public virtual bool CanHandleCommand(PrintingSystemCommand command, IPrintControl printControl) {
        // This handler is used for the ExportGraphic command.
        return command == PrintingSystemCommand.ExportGraphic;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PrintingSystem property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also