NSView’s Printing Support
NSView subclasses in Cocoa applications are responsible for drawing to the screen and to the printer. During a print operation, the -drawRect: method of a view being printed is called once for each page that is printed. The view is responsible for drawing the appropriate content within the rectangle passed to -drawRect: for each printed page. Basic printing is handled automatically by NSView’s implementation of the –print: method, which creates a print operation, uses the shared NSPrintInfo instance, displays a print panel, and, unless the user cancels the print operation, prints the view including all subviews.
It is often desirable to draw slightly differently if the drawing is being sent to a printer instead of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access