Mac OS X Reference Library Apple Developer
Search

Cocoa Printing Architecture

Cocoa’s printing architecture is composed of a half-dozen interconnected classes. Separate classes represent the Page Setup panel, the Print panel, the print settings, the print operation, the printer, and the object to be printed. Each of these classes is described here.

Printing is generally initiated by the user choosing the Print menu command, which usually sends either a print: or printDocument: message, depending on whether the application is NSDocument-based or not, up the responder chain. You receive the message either in a custom NSView object (if it has the keyboard focus), a window delegate, or an NSDocument object. Upon receipt, you create an NSPrintOperation object to manage the print job, tell it which NSView to print, add an accessory view to its print panel, if desired, and then run the operation. The NSView class defines several methods that you can override to control how the view is divided between multiple pages. From there, the view’s drawRect: method draws the view’s contents.

Subsequent sections of this document describe in greater detail how each part of Cocoa’s printing architecture works.




Last updated: 2006-06-28

Did this document help you? Yes It's good, but... Not helpful...