Important: The information in this document is obsolete and should not be used for new development.
Inherits from | |
Implements | |
Package | com.apple.cocoa.application |
Companion guide |
An NSPrinter object describes a printer’s capabilities as defined in its PPD file. An NSPrinter object can be constructed by specifying either the printer name or the make and model of an available printer. You use NSPrinter to get information about printers, not to modify printer attributes or control a printing job.
isKeyInTable
stringForKeyInTable
stringListForKeyInTable
booleanForKeyInTable
floatForKeyInTable
intForKeyInTable
rectForKeyInTable
sizeForKeyInTable
statusForTable
deviceDescription
acceptsBinary
domain
host
imageRectForPaper
isColor
isFontAvailable
isOutputStackInReverseOrder
note
Returns the names of all available printers.
public static NSArray printerNames
()
The user constructs the list of available printers with the Print Center application.
Returns descriptions of the makes and models of all available printers identified by printerNames
public static NSArray printerTypes
()
.
Returns an NSPrinter that represents the printer with the given name.
public static NSPrinter printerWithName
(String name)
Returns null
if the specified printer is not available.
Deprecated.
public static NSPrinter printerWithName
(String name, String domain, boolean includeUnavailable)
Returns an NSPrinter object that represents the first available printer that has the make and model described by type.
public static NSPrinter printerWithType
(String type)
type is of the form returned by printerTypes
.
Deprecated.
public boolean acceptsBinary
()
Returns a boolean
value associated with key in table.
public boolean booleanForKeyInTable
(String key, String table)
Also returns false
if key is not in table or if the receiver lacks a PPD file.
Returns a dictionary of keys and values describing the device.
public NSDictionary deviceDescription
()
See NSGraphics “Constants” for possible keys. The only key guaranteed to exist is NSDeviceIsPrinter
.
public String domain
()
Deprecated.
Returns a floating-point value associated with key in table.
public float floatForKeyInTable
(String key, String table)
Returns 0.0 if key is not in table or if the receiver lacks a PPD file.
Deprecated.
public String host
()
Deprecated.
public NSRect imageRectForPaper
(String paperName)
If used, it attempts to determine and return the bounds of the imagable area for a particular paper named paperName, but the result is not completely reliable.
Returns an integer value associated with key in table.
public int intForKeyInTable
(String key, String table)
Returns 0 if key is not in table or if the receiver lacks a PPD file.
Deprecated.
public boolean isColor
()
Deprecated.
public boolean isFontAvailable
(String faceName)
Returns true
if key is in table, false
otherwise.
public boolean isKeyInTable
(String key, String table)
Deprecated.
public boolean isOutputStackInReverseOrder
()
Returns the PostScript language level recognized by the printer.
public int languageLevel
()
Returns 0 if the receiver is not a Postscript printer.
Returns the printer’s name.
public String name
()
Deprecated.
public String note
()
Returns the size of the page for the paper type paperName.
public NSSize pageSizeForPaper
(String paperName)
Possible values for paperName are contained in the printer’s PPD file. Typical values are Letter and Legal. Returns a zero size if paperName is not recognized, or its entry in the PPD cannot be parsed.
Returns the rectangle associated with key in table.
public NSRect rectForKeyInTable
(String key, String table)
Returns NSRect.ZeroRect
if key is not in table or if the receiver lacks a PPD file.
Returns the size associated with key in table.
public NSSize sizeForKeyInTable
(String key, String table)
The returned width and height are 0.0 if key is not in table or if the receiver lacks a PPD file.
Returns the status of table.
public int statusForTable
(String table)
The possible return values are described in “Constants.”
Returns the first occurrence of a value associated with key in table.
public String stringForKeyInTable
(String key, String table)
If key is a main keyword only, and if that keyword has options in the PPD file, this method returns an empty string. Use stringListForKeyInTable
to retrieve the values for all occurrences of a main keyword. Returns null
if key is not in table.
isKeyInTable
booleanForKeyInTable
floatForKeyInTable
intForKeyInTable
rectForKeyInTable
sizeForKeyInTable
Returns an array of strings, one for each occurrence, associated with key in table.
public NSArray stringListForKeyInTable
(String key, String table)
Returns null
if key is not in table.
Returns a description of the printer’s make and model.
public String type
()
These constants describe the state of a printer information table stored by an NSPrinter object. They’re used by statusForTable
.
Constant | Description |
---|---|
PrinterTableOK | Printer table was found and is valid. |
PrinterTableNotFound | Printer table was not found. |
PrinterTableError | Printer table is not valid. |
© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)