Class

NSPrintOperation

An object that controls operations that generate Encapsulated PostScript (EPS) code, Portable Document Format (PDF) code, or print jobs.

Declaration

@interface NSPrintOperation : NSObject

Overview

An NSPrintOperation object works in conjunction with two other objects: an NSPrintInfo object, which specifies how the code should be generated, and an NSView object, which generates the actual code.

It is important to note that the majority of methods in NSPrintOperation copy the instance of NSPrintInfo passed into them. Future changes to that print info are not reflected in the print info retained by the current NSPrintOperation object. All changes should be made to the print info before passing to the methods of this class. The only method in NSPrintOperation which does not copy the NSPrintInfo instance is printInfo.

Topics

Creating an NSPrintOperation

+ EPSOperationWithView:insideRect:toData:

Creates and returns a new NSPrintOperation object ready to control the copying of EPS graphics from the specified view.

+ EPSOperationWithView:insideRect:toData:printInfo:

Creates and returns a new NSPrintOperation object ready to control the copying of EPS graphics from the specified view using the specified print settings.

+ EPSOperationWithView:insideRect:toPath:printInfo:

Creates and returns a new NSPrintOperation object ready to control the copying of EPS graphics from the specified view and write the resulting data to the specified file.

+ PDFOperationWithView:insideRect:toData:

Creates and returns a new NSPrintOperation object ready to control the copying of PDF graphics from the specified view.

+ PDFOperationWithView:insideRect:toData:printInfo:

Creates and returns a new NSPrintOperation object ready to control the copying of PDF graphics from the specified view using the specified print settings.

+ PDFOperationWithView:insideRect:toPath:printInfo:

Creates and returns a new NSPrintOperation object ready to control the copying of PDF graphics from the specified view and write the resulting data to the specified file.

+ printOperationWithView:

Creates and returns an NSPrintOperation object ready to control the printing of the specified view.

+ printOperationWithView:printInfo:

Creates and returns an NSPrintOperation object ready to control the printing of the specified view using custom print settings.

Setting the Current NSPrintOperation for This Thread

currentOperation

Returns the current print operation for this thread.

Determining the Type of Operation

copyingOperation

Returns a Boolean value indicating whether the receiver is an EPS or PDF copy operation.

Modifying the NSPrintInfo Object

printInfo

Sets the receiver’s NSPrintInfo object.

Getting the NSView Object

view

Returns the view object that generates the actual data for the print operation.

Printing Quality

preferredRenderingQuality

Returns the printing quality.

Running a Print Operation

- runOperation

Runs the print operation on the current thread.

- runOperationModalForWindow:delegate:didRunSelector:contextInfo:

Runs the print operation, calling your custom delegate method upon completion.

- cleanUpOperation

Called at the end of a print operation to remove the receiver as the current operation.

- deliverResult

Delivers the results of the print operation to the intended destination.

Modifying the User Interface

showsPrintPanel

Sets whether the receiver displays a print panel for this operation.

showsProgressPanel

Sets whether the receiver displays a progress panel for this operation.

jobTitle

Assigns a custom title to the print job.

printPanel

Sets the NSPrintPanel object to be used during the operation.

Managing the Drawing Context

context

Returns the graphics context object used for generating output.

- createContext

Creates the graphics context object used for drawing during the operation.

- destroyContext

Destroys the receiver’s graphics context.

Managing Page Information

currentPage

Returns the current page number being printed.

pageRange

Returns the range of pages associated with the print operation.

pageOrder

Sets the print order for the pages of the operation.

Managing Printing-Related Threads

canSpawnSeparateThread

Sets whether the receiver is allowed to spawn a separate printing thread.

Deprecated Methods

- jobStyleHint

Returns the type of content that the print job is printing.

Deprecated
- setJobStyleHint:

Sets the type of content that the print job is printing.

Deprecated
- accessoryView

Returns the accessory view used by the receiver’s print panel.

Deprecated
- setAccessoryView:

Sets the custom accessory view to be displayed by the receiver's print panel.

Deprecated
- showPanels

Returns a Boolean value that indicates whether the print panel is to be displayed.

Deprecated
- setShowPanels:

Sets whether the print operation should display a print panel.

Deprecated

Constants

NSPrintingPageOrder

These constants specify the page order.

Exception Name

This is the name of an exception that can be raised by NSPrintOperation.

NSPrintRenderingQuality

These constants specify the print quality in use.

Instance Properties

Relationships

Inherits From

See Also

Print Job Information

NSPrinter

An object that describes a printer’s capabilities.

NSPrintInfo

An object that stores information that’s used to generate printed output.