Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.

NSPrintInfo

Inherits From: NSObject

Conforms To: NSCoding, NSCopying NSObject (NSObject)

Declared In: AppKit/NSPrintInfo.h

Class Description

An NSPrintInfo object stores information that's used during printing. A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application. You can create any number of additional NSPrintInfo objects; however, only one can be active at a time, as set through the setSharedPrintInfo: class method. The shared NSPrintInfo object is returned through the sharedPrintInfo class method.

An NSPrintInfo object is used by the NSPrintOperations class to control printing. If you create special instances of NSPrintInfo objects for a specific printing task, you must ensure that either the application's shared NSPrintInfo object is current, or you must instantiate an NSPrintOperations object using one of its methods that explicitly designate an NSPrintInfo object.

Although you can set an NSPrintInfo's attributes through the methods it provides, this is usually the task of other objects, notably the NSPageLayout and NSPrintPanel objects. The NSView or NSWindow that's being printed may also supercede some NSPrintInfo settings. In particular, a NSView or NSWindow can supply the range of pages in the document and can provide its own pagination mechanism through the knowsPagesFirst:last: and rect:forPage: methods (see the documentation of these methods in the NSView class for details).

If the printed NSView or NSWindow doesn't supply a pagination, the NSPrintInfo's vertical and horizontal pagination constants are used to trigger built-in pagination mechanisms:

Pagination Constant Meaning

NSAutoPagination The image is diced into equal-sized rectangles and placed in one column of pages.

NSFitPagination The image is scaled to produce one column or one row of pages.

NSClipPagination The image is clipped to produce one column or row of pages.

Vertical and horizontal pagination needn't be the same. However, if either dimension is scaled (NSFitPagination), the other dimension is scaled by the same amount to avoid stretching the image. If both dimensions are scaled, the scaling factor that produces the smallest image is used. Note that NSPrintInfo's scaling factor is independent of the scaling that's imposed by pagination and is applied after the document has been paginated.

NSPrintInfo uses points as the unit of measurement for paper size and margin width in the methods below. See the NSFont specification for a discussion of points.

Creating and Initializing an NSPrintInfo Instance

Managing the Shared NSPrintInfo Object

Managing the Printing Rectangle

Pagination

Positioning the Image on the Page

Specifying the Printer

Controlling Printing

Accessing the NSPrintInfo Object's Dictionary