class printJobDialog

superclass(es) object
subclass(es) -
description This class displays the standard print job dialog. The available printer options for a new print job are displayed. The number of copies, the size and orientation of the paper and other print job options can be set, another printer can also be selected for the print job.
see also printer - printerCanvas - printerSetupDialog - canvas

tasks

Before the print job dialog can be displayed an instance of the printer class must be allocated, this instance is used by the dialog to retrieve the current printer settings and store the new settings chosen by the user. If the dialog is closed by pressing on the "Ok" button the settings are stored in the printer instance, the printer instance can be assigned by the method putPrinter/1. The number of copies and the orientation of the paper can be set by the methods putNumCopies/1 and putLandscape/1.

To set the size of the paper there are 41 predefined sizes, these are:

ID Atomic name Name Size (Width x Height)
1 ps_letter Letter 215 x 279 mm (8 1/2 x 11 inch)
2 ps_lettersmall Letter small 215 x 279 mm (8 1/2 x 11 inch)
3 ps_tabloid Tabloid 279 x 431 mm (11 x 17 inch)
4 ps_ledger Ledger 431x 279 mm (17 x 11 inch)
5 ps_legal Legal 215 x 355 mm (8 1/2 x 14 inch)
6 ps_statement Statement 139 x 215 mm (5 1/2 x 8 1/2 inch)
7 ps_executive Executive 184 x 266 mm (7 1/4 x 10 1/2 inch)
8 ps_a3 A3 297 x 420 mm
9 ps_a4 A4 210 x 297 mm
10 ps_a4small A4 small 210 x  297 mm
11 ps_a5 A5 148 x 210 mm
12 ps_b4 B4 250 x 354 mm
13 ps_b5 B5 182 x 257mm
14 ps_folio Folio 215 x 330 mm (8 1/2 x 13 inch)
15 ps_quarto Quarto 215 x 275 mm
16 ps_10x14 10x14 254 x 355 mm (0x14 inch)
17 ps_11x17 11x17 279 x 431 mm (11x17 inch)
18 ps_note Note 215 x 279 mm (8 1/2 x 11 inch)
19 ps_env_9 Envelope #9 984 x 225 mm ( 3 7/8 x 8 7/8 inch)
20 ps_env_10 Envelope #10 104 x 241 mm (4 1/8 x 9 1/2 inch)
21 ps_env_11 Envelope #11 114 x 263 mm (4 1/2 x 10 3/8 inch)
22 ps_env_12 Envelope #12 120 x 279 mm (4 \276 x 11 inch)
23 ps_env_14 Envelope #14 127 x 292 mm (5 x 11 1/2 inch)
24 ps_csheet C size sheet 431 x 558 mm
25 ps_dsheet D size sheet 558 x 863 mm
26 ps_esheet E size sheet 863 x 1117 mm
27 ps_env_dl Envelope DL 110 x 220 mm
28 ps_env_c5 Envelope C5 162 x 229 mm
29 ps_env_c3 Envelope C3 324 x 458 mm
30 ps_env_c4 Envelope C4 229 x 324 mm
31 ps_env_c6 Envelope C6 114 x 162 mm
32 ps_env_c65 Envelope C65 114 x 229 mm
33 ps_env_b4 Envelope B4 250 x 353 mm
34 ps_env_b5 Envelope B5 176 x 250 mm
35 ps_env_b6 Envelope B6 176 x 125 mm
36 ps_env_italy Envelope Italy 110 x 230 mm
37 ps_env_monarch Envelope monarch 98 x 190) mm (3.875 x 7.5 inch)
38 ps_env_personal Envelope personal 92 x 165 mm (3 5/8 x 6 1/2 inch)
39 ps_fanfold_us Fanfold us 377 x 279 mm (14 7/8 x 11 inch)
40 ps_fanfold_std_german Fanfold standard german 215 x 304 (8 1/2 x 12 inch)
41 ps_fanfold_lgl_german Fanfold legal german 215 x 330 (8 1/2 x 13 inch)

To set the paper size the method putPaperSize/1 can be used, the parameter of this method must an integer identifying the paper, in the table above these identifiers are in the first column. The second column contains an unique atom for the papersize and the third column contains a name that is suitable for displaying. The last column contains the width and height of the paper in millimeters. The module win.txt contains 41 predicates papersize/5 that contain the same information. For instance:

papersize(2, ps_lettersmall, 'Letter small', 215, 279). 
papersize(3, ps_tabloid, 'Tabloid', 279, 431).

It is possible to use a different paper size than the sizes in the table above, to do this the argument of putPaperSize/1 must be 0 and the methods putPaperHeight/1 and putPaperWidth/1 must be used to set the height and width.

To show the dialog the method execute/2 must be used.

methods

putPrinter(Printer)

func Assign the printer instance to use for retrieving and storing print job settings.
pre The variable Printer must refer to an instance of the class printer.
post The value of the parameter Printer was stored.

execute(Parent, Output)

func Show the print job dialog.
pre The variable Parent must refer to an instance of the class window.
post If the user pressed the "Ok" button the boolean value of true was assigned to Output, else was false assigned.

putNumCopies(Num)

func Set the number of copies to print.
pre The variable Num must contain an integer value.
post The value of Num was stored.

numCopies(Output)

func Retrieve the number of copies to print.
pre TRUE
post The number of copies to print was assigned to Output.

putLandscape(YesNo)

func Set the landscape or normal paper orientation.
pre The variable YesNo must contain a boolean value.
post If YesNo contained the value true then the paper orientation was set to landscape, else the paper orientation was set to normal.

landscape(Output)

func Determine if the paper orientation is landscape or normal.
pre TRUE
post If the paper orientation is landscape then true was assigned to the variable Output, else was false assigned.

putPaperSize(Paper)

func Set the paper size, one of the predefined constants can be used or use the value 0 to set a user defined paper size.
pre The variable Paper must contain an integer value.
post The paper size was stored, if the value 0 was set then the methods putPaperWidth/1 and puPaperHeight/1 must be called to set the width and height.

paperSize(Output)

func Get the paper size.
pre TRUE
post The paper size constant was assigned to the variable Output.

putPaperHeight(Height)

func For a user defined paper size set the height, the height of the paper must be specified in millimeters.
pre The variable Height must contain an integer value.
post The paper height was stored.

paperHeight(Output)

func Get the paper height for a user defined paper size.
pre TRUE
post The paper height value was assigned to the variable Output.

putPaperWidth(Width)

func For a user defined paper size set the width, the width of the paper must be specified in millimeters.
pre The variable Width must contain an integer value.
post The paper width was stored.

paperWidth(Output)

func Get the paper width for a user defined paper size.
pre TRUE
post The paper width value was assigned to the variable Output.