Skip to main content

Step 3 — Customize Print Preview Page Settings

  • 3 minutes to read

This topic contains an overview of print page customization options.

Tip

The core print-related APIs are designed for simple document generation scenarios and print/content export operations available for the majority of DevExpress VCL Controls (shipped as part of ExpressQuantum Pack, VCL Subscription, and VCL Subscription+).

For most advanced report generation and BI/data analytics usage scenarios, we recommend that you use our ExpressReports and ExpressDashboards Suites (available as part of the VCL Subscription +). These advanced solutions include both the powerful report generator and customizable print preview, BI dashboard designer and viewer for data analytics (available both at design- and runtime), smart/AI functions, non-GUI/service-based document generation, and much more.

Customize Page Margins

Display a collection editor for the TdxComponentPrinter component and click the Page Setup… button to display the corresponding dialog.

VCL Printing System: Display the "Page Setup" Dialog

Switch to the Margins tab and drag the left margin to the right to increase it.

VCL Printing System: Adjust the Left Page Margin

Horizontally and Vertically check boxes allow you to center printed content within the page.

Switch to the Header/Footer tab to define and customize page header and footer content. For example, you can use reserved character sequences to display corresponding information in the resulting document, such as the current time, page number, etc. Click buttons within the Predefined Functions pane to add the required placeholders. In addition, you can complement placeholders with static text.

VCL Printing System: A Defined Page Header Example

Click the Background button within the Header pane to select a fill color or effect.

VCL Printing System: Background Fill Settings

Click the OK button to close the dialog and apply pending changes.

VCL Printing System: Apply Header Changes

Configure Page Background Settings

Click the ellipsis button for the print link’s PrintedPage.Background property in the Object Inspector to display the Fill Effects dialog. Select the White Marble texture and click the OK button to apply the change.

VCL Printing System: Fill the Background Using the White Marble Texture

Run the application and click the Print the ListBox button to display the Print Preview dialog. Page appearance changes according to the modified settings.

VCL Printing System: The Print Preview Dialog Example

Display Print Configuration Dialogs at Runtime

To display Page Setup and Fill Effects dialogs at runtime, you can add two buttons and handle their OnClick events as follows:

uses
  dxPSCore,    // Declares the TdxComponentPrinter component and related types
  dxPSLbxLnk,  // Declares the TdxListBoxReportLink component
  cxButtons;   // Declares the TcxButton component
// ...

procedure TMyForm.cxPageSetupButtonClick(Sender: TObject);
begin
  dxListBoxReportLink1.PageSetup;  // Displays the "Page Setup" dialog
end;

procedure TMyForm.cxFillEffectsButtonClick(Sender: TObject);
begin
  dxListBoxReportLink1.PrinterPage.Background.SetupEffects;  // Displays the "Fill Effects" dialog
end;

Run & Test the App

Run the test app and click the created buttons to display corresponding dialogs.

VCL Printing System: The "Fill Effects" Dialog

Tip

Users can display these dialogs using Page Setup and Background toolbar buttons within the Print Preview dialog (or using File | Page Setup… and Format | Background… menu items).

Next Step

The next step generates one document using multiple different controls as sources simultaneously.