9.127 LIST_PRINTERS
This BIF will return a list of printers currently configured on the machine.
Refer to Technical Notes if running on Windows Vista.
Arguments
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Opt | Printer Location A – All printers L – Local Only - use always with IBM i. Default is A. | 1 | 1 |
Return Values
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | L | Req | Working List containing the printer's full name (see technical notes). The list must be in the following format: From – To Description 1 – 255 Printer Name 256 – 256 Printer Location (L – local, N – network). | 255 | 255 | ||
2 | A | Req | Return Code OK = list returned successfully OV = list returned completely filled but more printers than could fit in the list still exist. NR = empty list returned ER = an error occurred | 2 | 2 |
Technical Notes
The working list will return the full printer name. This includes the domain name for remote printers. That is //domain/PrinterName. For example, \\ourdomain\Epson Stylus COLOR 900.
If printing through a server function, this BIF should be run on the server to obtain the list of printers available to the server and the list then passed back to the client. The selected printer name may then be sent to the server function that will perform the printing.
If running on Windows Vista, there is a limit to the number of printers that can be defined using this Built-In Function. This includes both local and remote printers. The limit depends on the printers defined, but as a guide, you should limit the number of printers to 12.
Example
FUNCTION OPTIONS(*DIRECT)
DEF_LIST NAME(#PRNLIST) FIELDS(#PRN_NAME #PRN_LOC) TYPE(*WORKING)
USE BUILTIN(LIST_PRINTERS) WITH_ARGS(A) TO_GET(#PRNLIST #STD_CMPAR)