Selecting a printer
There are several different approaches to selecting a printer. The recommended approach is to allow the user to choose a printer display using a printer prompter. For more information on CwPrinterPrompter, see "Using the printer prompter".
If a user selection is not required, the application can choose to use the default printer. The default printer can be obtained by sending default to CgPrinterScreen class. It can be changed via printer configuration tools provided by the operating system, for example, the Print Manager in Windows. If there is no default printer, default answers nil.
A printer can also be selected by enumerating the printer screens available on a given display using the printerScreens method. For instance, printer screens on the default printer display can be obtained using CgDisplay defaultPrinterDisplay printerScreens. Printers on other displays can be listed by first opening a connection to the desired display, using CwAppContext openDisplay:, and then sending printerScreens to this printer display. Printer displays opened in this manner should always be closed when they are no longer needed by issuing close. The default printer display should not be closed.
Display names used for opening a printer display with openDisplay: can be obtained from CgDisplay allPrinterDisplayNames. Do not cache the results of allPrinterDisplayNames because printers can be added or removed from the operating system at any time. To obtain a human-readable name of a printer, use CgPrinterScreen name, rather than CgDisplay displayString
Last modified date: 12/22/2017