Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSPrinter

Inherits from
Implements
Package
com.apple.cocoa.application
Companion guide

Overview

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.

Tasks

Constructors

Creating an NSPrinter

Getting General Printer Information

Getting Attributes

Getting Specific Information

Querying the Tables

Deprecated Methods

Constructors

NSPrinter

Creates an empty NSPrinter.

public NSPrinter()

Static Methods

printerNames

Returns the names of all available printers.

public static NSArray printerNames()

Discussion

The user constructs the list of available printers with the Print Center application.

See Also

printerTypes

Returns descriptions of the makes and models of all available printers identified by printerNames

public static NSArray printerTypes()

Discussion

.

See Also

printerWithName

Returns an NSPrinter that represents the printer with the given name.

public static NSPrinter printerWithName(String name)

Discussion

Returns null if the specified printer is not available.

Deprecated.

public static NSPrinter printerWithName(String name, String domain, boolean includeUnavailable)

See Also

printerWithType

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)

Discussion

type is of the form returned by printerTypes.

See Also

Instance Methods

acceptsBinary

Deprecated.

public boolean acceptsBinary()

booleanForKeyInTable

Returns a boolean value associated with key in table.

public boolean booleanForKeyInTable(String key, String table)

Discussion

Also returns false if key is not in table or if the receiver lacks a PPD file.

See Also

deviceDescription

Returns a dictionary of keys and values describing the device.

public NSDictionary deviceDescription()

Discussion

See NSGraphics “Constants” for possible keys. The only key guaranteed to exist is NSDeviceIsPrinter.

domain

public String domain()

Discussion

Deprecated.

floatForKeyInTable

Returns a floating-point value associated with key in table.

public float floatForKeyInTable(String key, String table)

Discussion

Returns 0.0 if key is not in table or if the receiver lacks a PPD file.

See Also

host

Deprecated.

public String host()

imageRectForPaper

Deprecated.

public NSRect imageRectForPaper(String paperName)

Discussion

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.

See Also

intForKeyInTable

Returns an integer value associated with key in table.

public int intForKeyInTable(String key, String table)

Discussion

Returns 0 if key is not in table or if the receiver lacks a PPD file.

See Also

isColor

Deprecated.

public boolean isColor()

isFontAvailable

Deprecated.

public boolean isFontAvailable(String faceName)

isKeyInTable

Returns true if key is in table, false otherwise.

public boolean isKeyInTable(String key, String table)

isOutputStackInReverseOrder

Deprecated.

public boolean isOutputStackInReverseOrder()

languageLevel

Returns the PostScript language level recognized by the printer.

public int languageLevel()

Discussion

Returns 0 if the receiver is not a Postscript printer.

name

Returns the printer’s name.

public String name()

See Also

note

Deprecated.

public String note()

pageSizeForPaper

Returns the size of the page for the paper type paperName.

public NSSize pageSizeForPaper(String paperName)

Discussion

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.

See Also

rectForKeyInTable

Returns the rectangle associated with key in table.

public NSRect rectForKeyInTable(String key, String table)

Discussion

Returns NSRect.ZeroRect if key is not in table or if the receiver lacks a PPD file.

See Also

sizeForKeyInTable

Returns the size associated with key in table.

public NSSize sizeForKeyInTable(String key, String table)

Discussion

The returned width and height are 0.0 if key is not in table or if the receiver lacks a PPD file.

See Also

statusForTable

Returns the status of table.

public int statusForTable(String table)

Discussion

The possible return values are described in “Constants.”

stringForKeyInTable

Returns the first occurrence of a value associated with key in table.

public String stringForKeyInTable(String key, String table)

Discussion

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.

See Also

stringListForKeyInTable

Returns an array of strings, one for each occurrence, associated with key in table.

public NSArray stringListForKeyInTable(String key, String table)

Discussion

Returns null if key is not in table.

See Also

type

Returns a description of the printer’s make and model.

public String type()

See Also

Constants

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.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.