Using the Common Print Setup Dialog

The Windows Common Print Setup dialog enables you to set options for a print task. Some options are standard and apply to most printers; for example, copies, duplex, orientation, and so on. You can set these properties in your JADE code. These properties are combined with the default settings of the printer to carry out the printing task in JADE.

Other advanced options are specific to the printer; for example, the number of pages per sheet and booklet printing. You cannot set these advanced options in your JADE code. These options are normally set on an advanced settings sheet on the Print Setup dialog. The useCustomPrinterSettings method instructs the JADE printing engine to combine the standard JADE printing properties (copies, duplex, orientation, and so on) with advanced settings that were cached from the most-recent occasion the common Print Setup dialog was opened.

The following example shows a common Print Setup dialog being displayed by setting the value of the printSetup property to true. Before starting to print, the useCustomPrinterSettings method is called so that the advanced settings from the Print Setup dialog are used instead of the default printer settings.

vars
    dialog : CMDPrint;
begin
    create dialog transient;
    dialog.initializeWith := CMDPrint.InitializeWith_MostRecentSetup;
    dialog.printSetup := true;
    if dialog.open <> null then
        return;      // User clicked Cancel button or Windows error occurred
    endif;
    // To use the printer-specific options you set on the Print Setup dialog
    app.printer.useCustomPrinterSettings();
    // Printing instructions such as "app.printer.print" would follow
    ...
end;

This method is available only when the value of the PrintDataType parameter in the [JadePrinting] section of the JADE initialization file is set to GDI.

A JADE application can remember one set of advanced printer settings only. The set of properties can be different for each application.

When the Print Setup dialog is displayed more than once, only the last set of settings are cached.

Each printer retains the advanced settings until the print task is complete; that is, until the close method is called.