<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPrintOperation",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPrintOperation"
  },
  "title" : "NSPrintOperation"
}
-->

# NSPrintOperation

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

```
@MainActor class NSPrintOperation
```

## Overview

An [`NSPrintOperation`](/documentation/AppKit/NSPrintOperation) object works in conjunction with two other objects: an [`NSPrintInfo`](/documentation/AppKit/NSPrintInfo) object, which specifies how the code should be generated, and an [`NSView`](/documentation/AppKit/NSView) object, which generates the actual code.

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

> Note:
> You should not subclass ``doc://com.apple.appkit/documentation/AppKit/NSPrintOperation``. Methods that return a print operation object return an instance of a concrete subclass whose implementation is private.

## Topics

### Creating the Printing Operation Object

[`epsOperation(with:inside:to:)`](/documentation/AppKit/NSPrintOperation/epsOperation(with:inside:to:))

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

[`epsOperation(with:inside:to:printInfo:)`](/documentation/AppKit/NSPrintOperation/epsOperation(with:inside:to:printInfo:))

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

[`epsOperation(with:inside:toPath:printInfo:)`](/documentation/AppKit/NSPrintOperation/epsOperation(with:inside:toPath:printInfo:))

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

[`pdfOperation(with:inside:to:)`](/documentation/AppKit/NSPrintOperation/pdfOperation(with:inside:to:))

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

[`pdfOperation(with:inside:to:printInfo:)`](/documentation/AppKit/NSPrintOperation/pdfOperation(with:inside:to:printInfo:))

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

[`pdfOperation(with:inside:toPath:printInfo:)`](/documentation/AppKit/NSPrintOperation/pdfOperation(with:inside:toPath:printInfo:))

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

[`init(view:)`](/documentation/AppKit/NSPrintOperation/init(view:))

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

[`init(view:printInfo:)`](/documentation/AppKit/NSPrintOperation/init(view:printInfo:))

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

### Setting the Current Print Operation for This Thread

[`current`](/documentation/AppKit/NSPrintOperation/current)

The current print operation for this thread.

### Determining the Type of Operation

[`isCopyingOperation`](/documentation/AppKit/NSPrintOperation/isCopyingOperation)

A Boolean value that indicates whether the print operation is an EPS or PDF copy operation.

### Modifying the Printing Information

[`printInfo`](/documentation/AppKit/NSPrintOperation/printInfo)

The printing information associated with the print operation.

[`NSPrintInfo`](/documentation/AppKit/NSPrintInfo)

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

### Getting the View

[`view`](/documentation/AppKit/NSPrintOperation/view)

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

### Getting the Printing Quality

[`preferredRenderingQuality`](/documentation/AppKit/NSPrintOperation/preferredRenderingQuality)

The printing quality.

[`NSPrintOperation.RenderingQuality`](/documentation/AppKit/NSPrintOperation/RenderingQuality)

Constants that specify the print quality in use.

### Running the Print Operation

[`run()`](/documentation/AppKit/NSPrintOperation/run())

Runs the print operation on the current thread.

[`runModal(for:delegate:didRun:contextInfo:)`](/documentation/AppKit/NSPrintOperation/runModal(for:delegate:didRun:contextInfo:))

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

[`cleanUp()`](/documentation/AppKit/NSPrintOperation/cleanUp())

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

[`deliverResult()`](/documentation/AppKit/NSPrintOperation/deliverResult())

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

### Modifying the User Interface

[`showsPrintPanel`](/documentation/AppKit/NSPrintOperation/showsPrintPanel)

A Boolean value that determines whether the print operation displays a print panel.

[`showsProgressPanel`](/documentation/AppKit/NSPrintOperation/showsProgressPanel)

A Boolean value that determines whether the print operation displays a progress panel.

[`jobTitle`](/documentation/AppKit/NSPrintOperation/jobTitle)

The custom title of the print job.

[`printPanel`](/documentation/AppKit/NSPrintOperation/printPanel)

The print panel object to use during the operation.

[`pdfPanel`](/documentation/AppKit/NSPrintOperation/pdfPanel)

The PDF panel object to use during the operation.

### Managing the Drawing Context

[`context`](/documentation/AppKit/NSPrintOperation/context)

The graphics context object used for generating output.

[`createContext()`](/documentation/AppKit/NSPrintOperation/createContext())

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

[`destroyContext()`](/documentation/AppKit/NSPrintOperation/destroyContext())

Destroys the print operation’s graphics context.

### Managing Page Information

[`currentPage`](/documentation/AppKit/NSPrintOperation/currentPage)

The current page number being printed.

[`pageRange`](/documentation/AppKit/NSPrintOperation/pageRange)

The range of pages associated with the print operation.

[`pageOrder`](/documentation/AppKit/NSPrintOperation/pageOrder-swift.property)

The print order for the pages of the operation.

[`NSPrintOperation.PageOrder`](/documentation/AppKit/NSPrintOperation/PageOrder-swift.enum)

Constants that specify the page order.

### Managing Printing Threads

[`canSpawnSeparateThread`](/documentation/AppKit/NSPrintOperation/canSpawnSeparateThread)

A Boolean value that determines whether the print operation is allowed to spawn a separate printing thread.

### Deprecated

[`jobStyleHint`](/documentation/AppKit/NSPrintOperation/jobStyleHint)

The type of content that the print job is printing.

[`setJobStyleHint:`](/documentation/AppKit/NSPrintOperation/setJobStyleHint:)

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

[`accessoryView`](/documentation/AppKit/NSPrintOperation/accessoryView)

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

[`setAccessoryView:`](/documentation/AppKit/NSPrintOperation/setAccessoryView:)

Sets the custom accessory view to be displayed by the print operation’s print panel.

[`showPanels`](/documentation/AppKit/NSPrintOperation/showPanels)

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

[`setShowPanels:`](/documentation/AppKit/NSPrintOperation/setShowPanels:)

Sets whether the print operation should display a print panel.

### Constants

[`NSPrintOperationExistsException`](/documentation/AppKit/NSPrintOperationExistsException)

The name of an exception raised when there is already a print operation in process.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)