| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSPrinter.h |
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 a printer object to get information about printers, not to modify printer attributes or control a printing job.
– isKey:inTable:
– stringForKey:inTable:
– stringListForKey:inTable:
– booleanForKey:inTable:
– floatForKey:inTable:
– intForKey:inTable:
– rectForKey:inTable:
– sizeForKey:inTable:
– statusForTable:
– deviceDescription
+ printerWithName:domain:includeUnavailable: Deprecated in Mac OS X v10.2
– acceptsBinary Deprecated in Mac OS X v10.2
– domain Deprecated in Mac OS X v10.2
– host Deprecated in Mac OS X v10.2
– imageRectForPaper: Deprecated in Mac OS X v10.2
– isColor Deprecated in Mac OS X v10.2
– isFontAvailable: Deprecated in Mac OS X v10.2
– isOutputStackInReverseOrder Deprecated in Mac OS X v10.2
– note Deprecated in Mac OS X v10.2
Returns the names of all available printers.
+ (NSArray *)printerNames
An array of NSString objects, each of which contains the name of an available printer.
The user constructs the list of available printers using the Print Center application.
NSPrinter.h
Returns descriptions of the makes and models of all available printers.
+ (NSArray *)printerTypes
An array of NSString objects, each of which contains the make and model information for a supported printer.
NSPrinter.h
Creates and returns an NSPrinter object initialized with the specified printer name.
+ (NSPrinter *)printerWithName:(NSString *)name
The name of the printer.
An initialized NSPrinter object, or nil if the specified printer was not available.
NSPrinter.h
Creates and returns an NSPrinter object initialized to the first available printer with the specified make and model information.
+ (NSPrinter *)printerWithType:(NSString *)type
A string describing the make and model information. You can get this string using the printerTypes method.
An initialized NSPrinter object, or nil if the specified printer was not available.
NSPrinter.hReturns the Boolean value associated with the specified key.
- (BOOL)booleanForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The Boolean value associated with the key. Returns NO if the key is not in the table or the receiver lacks a PPD file.
NSPrinter.h
Returns a dictionary of keys and values describing the device.
- (NSDictionary *)deviceDescription
A dictionary of the device properties. See NSGraphics.h for possible keys. The only key guaranteed to exist is NSDeviceIsPrinter.
NSPrinter.h
Returns the floating-point value associated with the specified key.
- (float)floatForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The floating-point value. Returns 0.0 if the key is not in the table or the receiver lacks a PPD file.
NSPrinter.hReturns the integer value associated with the specified key.
- (int)intForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The integer value. Returns 0 if the key is not in the table or the receiver lacks a PPD file.
NSPrinter.hReturns a Boolean value indicating whether the specified key is in the specified table.
- (BOOL)isKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
YES if the key is in the table; otherwise, NO.
NSPrinter.h
Returns the PostScript language level recognized by the printer.
- (NSInteger)languageLevel
The PostScript language level. The value is 0 if the receiver is not a PostScript printer.
NSPrinter.hReturns the printer’s name.
- (NSString *)name
The printer name.
NSPrinter.hReturns the size of the page for the specified paper type.
- (NSSize)pageSizeForPaper:(NSString *)paperName
Possible values are printer-dependent and are contained in the printer's PPD file. Typical values are "Letter" and "Legal".
The size of the page, measured in points in the user coordinate space. The returned size is zero if the specified paper name is not recognized or its entry in the PPD file cannot be parsed.
NSPrinter.h
Returns the rectangle associated with the specified key.
- (NSRect)rectForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The rectangle value. Returns NSZeroRect if the key is not in the table or the receiver lacks a PPD file.
NSPrinter.h
Returns the size data type associated with the specified key.
- (NSSize)sizeForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The size value. Returns NSZeroSize if the key is not in the table or the receiver lacks a PPD file.
NSPrinter.hReturns the status of the specified table.
- (NSPrinterTableStatus)statusForTable:(NSString *)table
The name of a table from the printer's PPD file.
One of the return values described in “Constants.”
NSPrinter.hReturns the first occurrence of a value associated with specified key.
- (NSString *)stringForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
The value for the specified key, or nil if the key is not in the table. The returned string may also be empty.
If key is a main keyword only, and if that keyword has options in the PPD file, this method returns an empty string. Use stringListForKey:inTable: to retrieve the values for all occurrences of a main keyword.
– isKey:inTable:– booleanForKey:inTable:– floatForKey:inTable:– intForKey:inTable:– rectForKey:inTable:– sizeForKey:inTable:NSPrinter.hReturns an array of strings, one for each occurrence, associated with specified key.
- (NSArray *)stringListForKey:(NSString *)key inTable:(NSString *)table
The key whose value you want.
The name of a table from the printer's PPD file.
An array of NSString objects, each containing a value associated with the specified key. Returns nil if the key is not in the table.
NSPrinter.hReturns a description of the printer’s make and model.
- (NSString *)type
A description of the printer's make and model.
NSPrinter.hThese constants describe the state of a printer information table stored by an NSPrinter object.
typedef enum _NSPrinterTableStatus { NSPrinterTableOK = 0, NSPrinterTableNotFound = 1, NSPrinterTableError = 2 } NSPrinterTableStatus;
NSPrinterTableOKPrinter table was found and is valid.
Available in Mac OS X v10.0 and later.
Declared in NSPrinter.h.
NSPrinterTableNotFoundPrinter table was not found.
Available in Mac OS X v10.0 and later.
Declared in NSPrinter.h.
NSPrinterTableErrorPrinter table is not valid.
Available in Mac OS X v10.0 and later.
Declared in NSPrinter.h.
These constants are used by statusForTable:..
NSPrinter.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-01-29)