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.v20.2.Core.dll

Declaration

PrintingSystemBase PrintingSystem { get; }
ReadOnly Property PrintingSystem As PrintingSystemBase

Property Value

Type Description
PrintingSystemBase

A PrintingSystemBase descendant.

Examples

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