ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Q: How do I determine the network address of the currently selected printer (assuming that it is a network printer)? A: Usually, you can get name of the current printer from the
' Attached is some sample code for you to use. The following is the most reliable way to find the chosen printer's driver:
Once you've located the chosen printer's driver using one of these
methods, open its resource (using Prior to the introduction of GrayShare, there were only two basic classes of printers: local printers (a printer connected to and usable only by the computer it is connected to) and network printers (a printer networked to and usable by several computers). Local printers cannot be named, so they are identified by the port they are connected to. For this reason, the following printer drivers do not allow names to be attached to printers:
Network printers, by contrast, are nameable. A copy of the selected printer's
name is encoded in the driver's '
Since the introduction of GrayShare, there are three classes of printers:
local, network, and shared. Shared printers are those that are connected to one
machine but can optionally be shared by other machines on a network. Shared
printers store a copy of the selected printer's name in the driver's '
A GrayShare driver such as StyleWriter II can operate in either of two modes. If the user selects a StyleWriter that is connected to a serial port, the driver behaves like a local printer driver. If the user selects a shared printer, the driver must act as a client to the printer owner's server. In this situation the driver appears to behave as a normal networked printer, even though the actual mechanism used is considerably different. Although the '
Most applications can rely on finding the name of a LaserWriter being in ' There is an old undocumented technique for bypassing the chooser by manipulating the values stored in the places mentioned above. If you are thinking of doing this, take note of the following question and answer: Question: We've been manually writing ' Answer: LaserWriter 8.0 needs to know more about the printer than its AppleTalk name -- it also has to have a parsed and ready-to-use PPD file for that printer. Since there's so little memory available in applications such as the Finder during printing, parsing is done at Chooser time, not at print time. Apple has always said, We can't guarantee that you can change printers behind the Chooser's back, and with LaserWriter 8.0 this is true. If the driver has parsed a PPD file and has it ready, this should work, but you would have to have manually chosen that printer before and set everything up. If you set up a LaserWriter IINTX printer with the correct PPD file, then choose a LaserWriter IIf, and then another printer driver, you can probably switch back to the LaserWriter IINTX programmatically. However, the driver will use the LaserWriter IIf PPD file with it, which may or may not cause PostScript errors. Designing the driver to be switchable by other applications was not a priority of the Adobe/Apple development team. As long as you try to switch to a printer that uses the same PPD file that the driver last parsed (the PPD associated with the last printer selected in the Chooser), there shouldn't be any more problems than there were before with earlier printer drivers. With QuickDraw GX, many things have changed, so you may need to re-think your
application's objectives in this environment. QuickDraw GX includes an all-new
printing manager and API, all-new extendable printer drivers, and an all-new
Chooser interface with desktop printer icons. It doesn't even have a '
|
|