---
title: "pdfOperation(with:inside:toPath:printInfo:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsprintoperation/pdfoperation(with:inside:topath:printinfo:)"
---

# 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.

## Declaration

```swift
class func pdfOperation(with view: NSView, inside rect: NSRect, toPath path: String, printInfo: NSPrintInfo) -> NSPrintOperation
```

## Parameters

- `view`: The view containing the data to be turned into PDF data.
- `rect`: The portion of the view (specified in points in the view’s coordinate space) to be rendered as PDF data.
- `path`: The path to a file. After the job is run, this file contains the PDF data.
- `printInfo`: The print settings to use when generating the PDF data.

## Return Value

Return Value The new NSPrintOperation object. You must run the operation to generate the PDF data.

## Discussion

Discussion This method raises an NSPrintOperationExistsException if there is already a print operation in progress; otherwise the returned object is made the current print operation for this thread.

## See Also

### Related Documentation

- [run()](appkit/nsprintoperation/run().md)

### Creating the Printing Operation Object

- [epsOperation(with:inside:to:)](appkit/nsprintoperation/epsoperation(with:inside:to:).md)
- [epsOperation(with:inside:to:printInfo:)](appkit/nsprintoperation/epsoperation(with:inside:to:printinfo:).md)
- [epsOperation(with:inside:toPath:printInfo:)](appkit/nsprintoperation/epsoperation(with:inside:topath:printinfo:).md)
- [pdfOperation(with:inside:to:)](appkit/nsprintoperation/pdfoperation(with:inside:to:).md)
- [pdfOperation(with:inside:to:printInfo:)](appkit/nsprintoperation/pdfoperation(with:inside:to:printinfo:).md)
- [init(view:)](appkit/nsprintoperation/init(view:).md)
- [init(view:printInfo:)](appkit/nsprintoperation/init(view:printinfo:).md)
