About PrintOptions object

Build 1501 on 14/Nov/2017  This topic last edited on: 11/Jul/2014, at 15:45

The PrintOptions object contains all options for printing as PDF or PS. The options are saved in the database as a list of keyvalues. The keyvalues are saved to and loaded from two dictionaries: Dict for PDF options and DictPS for PS options. All operations of adding/modifying/deleting manipulate these dictionaries. Only at PrintOptions save/update, the object is re-filled with the new dictionary values. The dictionaries work with two enumeration structures, used to accept only valid options. All options in the dictionaries are filled with default values.

PDF options in any case affect the generation of the output file while the generation of PS has two steps; the generation of PDF and the transformation to PS (ready for the printer, if necessary).

The PrintOptions object replaces in the version 1.5 the PDFOptions object available in the previous versions and supports printing from Fred and Ted.

Whereas the old code was:

Dim opt As PDFOptions = Fred.GetPDFOptions("Default")

opt.ShowDlg(FredApp.GetAppGlobal(), Fred.Measure(False), Fred.Measure(True), menumde)

The new code is:

Dim optPrint As PrintOptions = Fred.GetPDFOptions("Default")

EditorialClient.PrintOptionsDlg.Show(optPrint, Fred.Measure(False), Fred.Measure(True), menumde)

Editing in script the PrintOptions object

The old PDFOptions was an object with the n defined attributes, while the new PrintOptions is a Dictionary with a key/value structure.

All keys are listed in the Editorial.TPrintOpt struct:

old PDFOptions:

opt.Caption = "string caption"

new PrintOptions:

opt.Caption = "string caption"

There is no 1:1 correspondence for the two structures, the new one has more keys and sometimes different syntax.

You can create a PrintOptions object as:

Dim opt As Editorial.PrintOptions

opt = Ted.GetPDFOptions("")

or

Dim opt As Editorial.PrintOptions

opt = Fred.GetPDFOptions("")