[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Expand]Detailed Guide to DevExpress Reporting
 [Expand]Visual Studio Report Designer
 [Collapse]Create End-User Reporting Applications
   Cross-Platform Reporting
  [Collapse]WinForms Reporting
   [Expand]Print API
   [Collapse]Print Preview
    [Expand]Quick Start
    [Expand]GUI
    [Collapse]API and Customization
      Quick Guide to Print Preview Customization
      Use Printing System Commands
      Add Items to a Print Preview's Standard Toolbar
      Add Items to a Print Preview's Ribbon Toolbar
      Provide Custom Editors for Report Parameters
      Change the Dock Panel View
   [Expand]End-User Report Designer
   [Expand]Application Security
   [Expand]Application Appearance
    Application Deployment
   [Expand]Localization
    End-User Documentation
  [Expand]WPF Reporting
  [Expand]Web Reporting
  [Expand]WCF Report Service
  [Expand]Discontinued Platforms
   Localization
   Redistribution and Deployment
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Use Printing System Commands

Various user actions in the Print Preview correspond to Printing System commands listed in the PrintingSystemCommand enumeration.

This document describes how to use these commands to manipulate Print Preview UI elements.

Expanded Execute Commands

You can execute Printing System commands by calling the PrintControl.ExecCommand method that calls the PrintingSystemBase.ExecCommand method internally.

Tip

Before using this method, call the PrintControl.CanExecCommand method to ensure valid command execution.

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

Expanded Override Commands

You can change the default behavior of Printing System commands by overriding them.

This example illustrates how to override a Printing System command.

A custom command handler must implement the ICommandHandler interface. You can add it to a Printing System's list of handlers using the PrintingSystemBase.AddCommandHandler method.

Tip

See the following tutorials to learn how to add custom items to a Print Preview's toolbar:

Expanded Change the Visibility of Commands

The Printing System defines UI elements' visibility corresponding to its commands (such as toolbar buttons or menu items). You can maintain their visibility in Print Preview using the PrintingSystemBase.SetCommandVisibility method.

This example illustrates how to change UI elements' visibility in the Print Preview using Printing System commands.

You can hide some of the dock panels from the Print Preview by calling the PrintControl.ExecCommand method with the corresponding parameter.

Tip

Before using this method, call the PrintControl.CanExecCommand method to ensure valid command execution.

This example illustrates how to hide various dock panels from Print Preview and remove the corresponding buttons from its toolbar.

Is this topic helpful?​​​​​​​