Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Execute Commands in the Print Preview

This example illustrates how to execute commands corresponding to various end-user actions in Print Preview by using the PrintControl.ExecCommand method of the DocumentViewer control.

Some of these commands are called without any parameters, while others require calling an overloaded version of the PrintControl.ExecCommand method accepting custom parameter values.

using DevExpress.XtraPrinting;
// ...

// Zoom a document to fit the entire page into Print Preview dimensions.
documentViewer1.ExecCommand(PrintingSystemCommand.ViewWholePage);

// Invoke the Hand tool.
documentViewer1.ExecCommand(PrintingSystemCommand.HandTool, new object[] {true}); 

// Hide the Hand tool.
documentViewer1.ExecCommand(PrintingSystemCommand.HandTool, new object[] {false});
See Also