The WR SET PRINT OPTION command is used to modify the value of a print option by programming for the 4D Write area designated by the area parameter. Each option defined using this command will remain applied to the 4D Write area until this area is erased. Options that are usually saved with 4D Write documents (such as orientation) are also saved.
The current print parameters of 4D and those of other 4D Write areas are not modified.
The option parameter lets you specify the option to be modified. You can pass either a value or one of the following predefined constants, located in the “WR Print options” theme.
Pass the new value(s) of the specified option in the value1 and (optionally) value2 and value3 parameters. The number and nature of the values to be passed depends on the type of option specified.
Certain values may have been set via constants, found in the WR Parameters theme. For more information about the options and their values, refer to the following table:
Option constant (Value) | value1 | value2 | value3 |
wr paper option (1) | Height | Width | - |
| 0 | 0 | Name |
wr orientation option (2) | wr portrait (1), wr landscape (2) | - | - |
wr scale option (3) | Number (%) | - | - |
wr number of copies option (4) | Number | - | - |
wr paper source option (5) | Windows only: |
| Index (number) | - | - |
wr pages from option (6) | Number (1=default) | - | - |
wr pages to option (7) | Number (1=default, end of document) | - | - |
wr color option (8) | wr black and white (1), wr color (2) | - | - |
wr destination option (9) | wr send to printer (1), | 0 | - |
| wr send to file (2), | 0 | Access path |
| wr send to PDF file (3) | 0 | Access path |
wr double sided option (11) | Windows only: |
| wr single sided (0) (standard) | - | - |
| wr double sided (1) | wr left binding (0) | - |
| (default), wr top binding |
wr spooler document name option (12) | 0 | 0 | Name of document |
- wr paper option (1): The list of all the names of available paper can be obtained using the 4D command PRINT OPTION VALUES.
You can either pass the name of the paper in value3 (and, in this case, pass 0 in value1 and value2), or pass the paper height in value1 and its width in value2. The width and height must be expressed in pixels. - wr orientation option (2): You can pass either the constant wr portrait (1) or wr landscape (2) in value1.
- wr scale option (3): Pass a percentage in value1. Be careful, some printers do not allow you to modify the scale. If you pass an invalid value, the property is reset to 100% at the time of printing.
- wr number of copies option (4): Pass the number of copies to be printed in value1.
- wr paper source option (5): In value1,pass the value of the element of the info1Array element that corresponds to the element of the namesArray returned by the 4D PRINT OPTION VALUES command. This array contains the name of the paper try to be used
Note: This option can only be used under Windows. - wr pages from option (6): Pass the number of the page where you want printing to start in value1. The default value is 1.
- wr pages to option (7): Pass the number of the last page that you want to be printed in value1. If you pass -1, the entire document will be printed (-1 is equivalent to passing the last page of the document).
- wr color option (8): In value1, pass the constant wr black and white (1) (monochrome) or wr color (2).
Note: This option can only be used under Windows. - wr destination option (9): In value1, pass one of the following constants: wr send to printer (1), wr send to file (2) (file for PC, PS for Mac) or wr send to PDF file (3) (Mac OS only).
Always pass 0 in value2.
If value1 is different from 1, pass the access path for the resulting document in value3. This path will be used until another path is specified. If a file with the same name already exists at the destination location, it will be replaced. Under Windows only: if you pass an empty string in value3 or omit this parameter, a file saving dialog appears at the time of printing. If the operation fails, the Printer (1) settings are applied. - wr double sided option (11): You can either pass the constant wr single sided (0) (standard) or wr double sided (1) in value1. If value1 is set to 1, you can set which type of binding to apply using value2: constant wr left binding (0, default value) or wr top binding (1).
Note: This option can only be used under Windows. - wr spooler document name option (12): In value3, pass the name of the print document that must appear in the list of spooler documents. Pass 0 in value1 and value2.
To use or restore standard operation (using the method name in case of a method, the table name for a record, etc.), pass an empty string in value3.
Warning: The name defined by this statement will be used for all the print documents of the session for as long as a new name or an empty string is not passed.
If the value passed for an option is invalid or if it is not available on the printer, the command returns an error (that you can intercept using an error-handling method installed by the WR ON ERROR command) and the current value of the option remains unchanged.
The OK system variable is set to 1 if the command has been executed correctly; otherwise, it is set to 0.