KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to select printers and paper trays using 4D commands
PRODUCT: 4D | VERSION: 2003.3 | PLATFORM: Win
Published On: April 29, 2004
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

To select printers and paper trays using 4D commands, you can use the 4D commands: PRINTERS LIST, SET CURRENT PRINTER, PRINT OPTION VALUES, and SET PRINT OPTION.

The PRINTERS LIST command retrieves a list of printers connected to your computer locally and/or through a network and stores the information in two arrays: printer name and the printer location.

Once you have gathered a list of printers, pass the specific printer name that you want to use to the SET CURRENT PRINTER command.

To be able to select a specific paper tray from the selected printer, use the command PRINT OPTION VALUES. This command requires an "option" parameter.

We are going to pass in the option--"Paper source option", which allows us to retrieve the paper trays from the specific current selected printer. The second parameter stores the value names available for the print option-"Paper source option" that was selected. Find out more about the PRINT OPTION VALUES command.

Once we have the information pertaining to the "Paper source option"-the paper trays, etc.- which are stored in the second parameter of the PRINT OPTION VALUES command, the next method that we need to call is the SET PRINT OPTION. We need to pass in the "option" parameter-"Paper source option" and the specific printer tray that we want to print from.

Below are example codes that were described previously:

PRINTERS LIST(prname;location)
SET CURRENT PRINTER(prname{1})
PRINT OPTION VALUES(5;namearray)
SET PRINT OPTION(5;namearray{4}
Print form([Table 1];"Form1")

You can find more information regarding this in the following Tech Note:
Tech Note ID# 27708 New Printing Capabilities with 4D 2003.