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 NSPrintInfo object stores information that’s used to generate output. A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application.
bottomMargin
imageablePageBounds
leftMargin
orientation
paperName
localizedPaperName
paperSize
rightMargin
setBottomMargin
setLeftMargin
setOrientation
setPaperName
setPaperSize
setRightMargin
setTopMargin
topMargin
Creates an empty NSPrintInfo.
public NSPrintInfo
()
Creates a new NSPrintInfo object, assigning it the parameters specified in aDictionary.
public NSPrintInfo
(NSDictionary aDictionary)
The possible key-value pairs contained in aDictionary are described in “Constants.”
Deprecated.
public static NSPrinter defaultPrinter
()
Deprecated.
public static void setDefaultPrinter
(NSPrinter aPrinter)
Sets the shared NSPrintInfo object to printInfo.
public static void setSharedPrintInfo
(NSPrintInfo printInfo)
The shared NSPrintInfo object defines the settings for the NSPageLayout panel and print operations that will be used if no NSPrintInfo object is specified for those operations. printInfo should never be null
.
Returns the shared NSPrintInfo object.
public static NSPrintInfo sharedPrintInfo
()
Deprecated.
public static NSSize sizeForPaperName
(String name)
Use NSPrinter’s method pageSizeForPaper
instead.
Returns the height of the bottom margin in points.
public float bottomMargin
()
Returns the receiver’s dictionary that stores its attribute settings
public NSMutableDictionary dictionary
()
. The key-value pairs contained in the dictionary are described in “Constants.” Modifying the returned dictionary changes the receiver’s attributes.
Returns the horizontal pagination mode.
public int horizontalPagination
()
It can return one of the pagination modes described in “Constants.”
Returns the imageable area of a sheet of paper specified by the receiver, taking into account the current printer, paper size, and orientation settings, but not scaling.
public NSRect imageablePageBounds
()
“Imageable area” is the maximum area that can possibly be marked on by the printer hardware, not the area defined by the current margin settings. The rectangle is in a coordinate space measured by points, with (0, 0) being the lower-left corner of the oriented sheet and (paperWidth, paperHeight) being the upper-right corner of the oriented sheet. The imageable bounds may extend past the edges of the sheet when, for example, a printer driver specifies it so that borderless printing can be done reliably.
Returns true
if the image is centered horizontally, false
otherwise.
public boolean isHorizontallyCentered
()
Returns true
if the image is centered vertically, false
otherwise.
public boolean isVerticallyCentered
()
Returns the action specified for the job.
public String jobDisposition
()
See setJobDisposition
for a description of return values.
Returns the width of the left margin in points.
public float leftMargin
()
Returns the human-readable name of the currently selected paper size, suitable for presentation in user interfaces.
public String localizedPaperName
()
This is typically different from the name returned by paperName
, which is almost never suitable for presentation to the user.
Returns the orientation attribute.
public int orientation
()
See setOrientation
for a description of return values.
Returns the paper name, such as Letter or Legal.
public String paperName
()
Paper names are implementation specific.
Returns the size of the paper in points.
public NSSize paperSize
()
Returns the NSPrinter to be used for printing.
public NSPrinter printer
()
Returns the width of the right margin in points.
public float rightMargin
()
Sets the bottom margin to margin specified in points.
public void setBottomMargin
(float margin)
public void setHorizontallyCentered
(boolean flag)
If flag is true
the image will be centered horizontally.
Sets the horizontal pagination to mode.
public void setHorizontalPagination
(int mode)
mode can be one of the pagination modes described in “Constants.”
Sets the action specified for the job to disposition.
public void setJobDisposition
(String disposition)
disposition can be one of the following:
PrintSpoolJob
is a normal print job.
PrintPreviewJob
sends the print job to the Preview application.
PrintSaveJob
saves the print job to a file.
PrintCancelJob
aborts the print job.
Sets the left margin to margin specified in points.
public void setLeftMargin
(float margin)
Sets the page orientation to orientation where orientation is either PortraitOrientation
or LandscapeOrientation
.
public void setOrientation
(int orientation)
This method may change either the paper name or size for consistency. To avoid this side effect set the values in the dictionary directly.
Sets the paper name to name (for example, Letter or Legal).
public void setPaperName
(String name)
Paper names are implementation specific. This method may change either the size or orientation for consistency. To avoid this side effect set the values in the dictionary directly.
Sets the width and height of the paper to aSize specified in points.
public void setPaperSize
(NSSize aSize)
This method may change either the paper name or orientation for consistency. To avoid this side effect set the values in the dictionary directly.
Sets the printer used in subsequent printing jobs to printer.
public void setPrinter
(NSPrinter printer)
This method iterates through the dictionary. If a feature in the dictionary is not supported by the new printer (as determined by a query to the PPD file), that feature is removed from the dictionary.
Sets the right margin to margin specified in points.
public void setRightMargin
(float margin)
Sets the top margin to margin specified in points.
public void setTopMargin
(float margin)
Validates the attributes encapsulated by the receiver.
public void setUpPrintOperationDefaultValues
()
Invoked when the print operation is about to start. Subclasses may override this method to set default values for any attributes that are not set.
public void setVerticallyCentered
(boolean flag)
If flag is true
, the image will be vertically centered.
Sets the vertical pagination to mode.
public void setVerticalPagination
(int mode)
mode can be one of the pagination modes described in “Constants.”
Returns the top margin in points.
public float topMargin
()
Returns the vertical pagination mode.
public int verticalPagination
()
It can return one of the pagination modes described in “Constants.”
These constants specify the different ways in which an image is divided into pages. They’re used by horizontalPagination
, setHorizontalPagination
, verticalPagination
, and setVerticalPagination
.
Pagination Constant |
Meaning |
---|---|
The image is divided into equal-sized rectangles and placed in one column of pages. |
|
The image is scaled to produce one column or one row of pages. |
|
The image is clipped to produce one column or row of pages. |
These constants specify page orientations. They’re used by orientation
and setOrientation
.
Orientation |
Meaning |
---|---|
Orientation is portrait (page is taller than it is wide). |
|
Orientation is landscape (page is wider than it is tall). |
These constants specify job dispositions. They’re used by jobDisposition
, and setJobDisposition
.
Mode |
Meaning |
---|---|
Normal print job. |
|
Send to Preview application. |
|
Save to a file. |
|
Cancel print job. |
The following sets of constants specify the keys in the dictionary returned by dictionary
or used to create an instance.
The following dictionary keys access page setup attributes.
Constant |
Type |
Description |
---|---|---|
String |
The paper name. |
|
NSSize |
Height and width of paper in points. |
|
int |
|
|
float |
Scale factor percentage before pagination. |
The following dictionary keys access pagination attributes.
Constant |
Type |
Description |
---|---|---|
float |
The left margin in points. |
|
float |
The right margin in points. |
|
float |
The top margin in points. |
|
float |
The bottom margin in points. |
|
boolean |
If |
|
boolean |
If |
|
int |
|
|
int |
|
The following dictionary keys access print job attributes.
Constant |
Type |
Description |
---|---|---|
NSPrinter |
The printer to use. |
|
int |
Number of copies to spool. |
|
boolean |
If |
|
int |
The first page in the print job. |
|
int |
The last page in the print job. |
|
boolean |
If |
|
boolean |
If |
|
String |
|
|
String |
Pathname to save as a file if job disposition is |
|
Number |
The number of logical pages to be tiled horizontally on a physical sheet of paper. (Available in Mac OS X v10.4 and later.) |
|
Number |
The number of logical pages to be tiled veritcally on a physical sheet of paper. (Available in Mac OS X v10.4 and later.) |
|
Date |
The time at which printing should begin. (Available in Mac OS X v10.4 and later.) |
|
Number, containing aboolean |
If |
|
String |
A fax number. (Available in Mac OS X v10.4 and later.) |
|
String |
The name of a printer. (Available in Mac OS X v10.4 and later.) |
© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)