Skip to main content

How to Use PDF Viewer Control Commands

  • 2 minutes to read

The PDF Viewer control provides its end-user functionality as a set of commands implemented by action objects (that is, instances of TdxPDFViewerCustomAction descendants).

You can implement a custom UI by manually creating the necessary Action objects and linking each of them to one or more individual UI elements in your application, such as buttons, menus, ribbon, and toolbar items, as an alternative to automatic design-time UI creation. To accomplish this, follow these step-by-step instructions:

  1. Add the standard VCL TActionList component from the Component Palette on an application form or select an existing action list to store the required Action object(s).

  2. Invoke the Action list’s editor either by double-clicking the TActionList component or clicking the “Action List Editor…” item in its context menu.

  3. Invoke the “Standard Action Classes” dialog by clicking the “New Standard Action…” item in the Action list editor’s context menu.

  4. Select the required action from the “DevExpress ExpressPDFViewer.Home” category and click the “OK” button.

  1. Select a control that has the Action property and assign the newly created action object to it using the Object Inspector.

Additionally, you can associate an action object with an icon. To do so, refer to the following instructions:

  1. Place a TcxImageList component on the application form and use the Image List Editor to populate the list with the required icons.

  2. Set the populated image list as the action list’s Images property value.

  3. Select a TdxPDFViewerCustomAction object in the Action list’s editor and specify the required icon’s index within the image list as the Action’s ImageIndex property value. As a result, all client controls that are capable of displaying icons display the specified icon.

Each command has a set of conditions that must be met for enabling all UI elements associated with it. For instance, the ShowPrintForm command is available to end users only if the PDF Viewer displays a loaded document (that is, the viewer’s IsDocumentLoaded function returns True) and has a valid report link in the TdxComponentPrinter component.

Refer to the Action class descriptions to learn about the conditions for individual commands.