4D v16.3

GET PRINT OPTION

Home

 
4D v16.3
GET PRINT OPTION

GET PRINT OPTION 


 

GET PRINT OPTION ( option ; value1 {; value2} ) 
Parameter Type   Description
option  Longint in Option number or PDF option code
value1  Longint, Text in Value 1 of the option
value2  Longint, Text in Value 2 of the option

The GET PRINT OPTION command returns the current value(s) of a print option.

The option parameter enables you to specify the option to get. You can either get a standard option (longint), or a PDF option code (string). The command returns, in the value1 and (optionally) value2 parameters, the current value(s) of the specified option.

To specify a standard printing option, you can use of the following predefined constants, located in the “Print Options” theme:

Constant Type Value Comment
Paper option Longint 1 If you use only value1, it contains the name of the paper. If you use both parameters, value1 contains the paper width and value2 contains the paper height. The width and height are expressed in screen pixels. Use the PRINT OPTION VALUES command to get the name, height and width of all the paper formats offered by the printer.
Orientation option Longint 2 value1 only: 1=Portrait, 2=Landscape. If a different orientation option is used, GET PRINT OPTION returns 0 in value1.
64-bit versions: This option can be called within a print job, which means that you can switch from portrait to landscape, or vice versa, during the same print job.
Scale option Longint 3 value1 only: scale value in percentage. 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.
Number of copies option Longint 4 value1 only: number of copies to be printed.
Paper source option Longint 5 (Windows only) value1 only: number corresponding to the index, in the array of trays returned by the PRINT OPTION VALUES command, of the paper tray to be used. This option can only be used under Windows.
Color option Longint 8 (Windows only) value1 only: code specifying the mode for handling color: 1=Black and white (monochrome), 2=Color.
64-bit versions: This option is not supported in 4D 64-bit versions (obsolete)
Destination option Longint 9 value1: code specifying the type of print destination: 1=Printer, 2=(PC)/PS File (Mac), 3=PDF file, 5=Screen (OS X driver option).
If value1 is different from 1 or 5, value2 contains pathname for resulting document. 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. With GET PRINT OPTION, if the current value is not in the predefined list, value1 contains -1 and the system variable OK is set to 1. If an error occurs, value1 and the system variable OK are set to 0.
Note
: Under Windows, you can set the printing destination to 3 (PDF File) when the PDF Creator driver has been installed. When the (9;3;path) values are passed, 4D automatically starts a "silent" PDF printing which takes into account any option codes that are passed (note that if you pass an empty string in value2 or omit this parameter, a file saving dialog appears at the time of printing.) After printing, the current settings are restored. This simplifies control of printing PDFs for 4D and lets you write multi-platform code. When the (9;3;path) values are not passed, printing is not controlled by 4D and any PDF Creator option codes that were passed are ignored.
Double sided option Longint 11 (Windows only) value1: 0=Single-sided or standard, 1=Double-sided. If value1=1, value2 contains the binding: 0=Left binding (default value), 1=Top binding.
Note: This option can only be used under Windows.
Spooler document name option Longint 12 value1 only: name of the current print document, which appears in the list of spooler documents. 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. To use or restore standard operation (using the method name in the case of a method, the table name for a record, etc.), pass an empty string in value1.
Mac spool file format option Longint 13 (Mac only) value1 only: 0=print job in PDF mode (default value) 1=print job in PostScript mode.
Notes:
- This option has no effect under Windows.
- Under OS X, printing is done as a PDF by default. However, the PDF print driver does not support PICT pictures with encapsulated PostScript information — these pictures are generated, more particularly, by vectorial drawing software. To avoid this problem, this option lets you modify the print mode to use under OS X for the current session. Keep in mind that printing in PostScript mode can lead to undesired side effects.
64-bit versions: This option is not supported; it is replaced by the Generic PDF driver option of the SET CURRENT PRINTER command.
Hide printing progress option Longint 14 (Mac only) value1 only: 1=hide progress windows, 0=display progress windows (default). This option is particularly useful in the case of PDF printing under OS X.
Note:
There is already a Printing progress option found in the Database Settings dialog box (Interface page). However, it is applied globally to the application and does not hide all the windows under OS X.
Page range option Longint 15 value1=first page to print (default value is 1) and (optional) value2=number of the last page to print (default value -1 = end of document).
Legacy printing layer option Longint 16 (4D 64-bit versions for Windows only) value1 only: 1=select the GDI-based legacy printing layer for the subsequent printing jobs. 0=select the D2D printing layer (default).
64-bit versions: This selector is only supported on 4D 64-bit single-user applications on Windows; it is ignored on other platforms. It is mainly intended to allow legacy plug-ins to print inside 4D jobs in 4D 64-bit applications.

A PDF option code consists of two parts, OptionType and OptionName, combined together as "OptionType:OptionName". For more information on PDF option codes and possible values, refer to the description of the SET PRINT OPTION command.

Note: The GET PRINT OPTION command mainly supports PostScript printers. You can use this command with other types of printers, such as PCL or Ink, but in this case, it is possible that some options may not be available.

The system variable OK is set to 1 if the command has been executed correctly; otherwise, it is set to 0.



See also 

PRINT OPTION VALUES
SET PRINT OPTION

 
PROPERTIES 

Product: 4D
Theme: Printing
Number: 734

The OK variable is changed by the commandThis command has platform-specific behaviorThis command has platform-specific behavior

 
HISTORY 

New
Modified: 4D 2004.3
Modified: 4D v15 R5
Modified: 4D v16

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)