---
title: "dataWithPDF(inside:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/datawithpdf(inside:)"
---

# dataWithPDF(inside:)

Returns PDF data that draws the region of the view within a specified rectangle.

## Declaration

```swift
func dataWithPDF(inside rect: NSRect) -> Data
```

## Parameters

- `rect`: A rectangle defining the region.

## Discussion

Discussion This data can be placed on an NSPasteboard object, written to a file, or used to create an NSImage object.

## See Also

### Printing the View’s Content

- [printView(_:)](appkit/nsview/printview(_:).md)
- [beginPage(in:atPlacement:)](appkit/nsview/beginpage(in:atplacement:).md)
- [dataWithEPS(inside:)](appkit/nsview/datawitheps(inside:).md)
- [printJobTitle](appkit/nsview/printjobtitle.md)
- [pageHeader](appkit/nsview/pageheader.md)
- [pageFooter](appkit/nsview/pagefooter.md)
- [writeEPS(inside:to:)](appkit/nsview/writeeps(inside:to:).md)
- [writePDF(inside:to:)](appkit/nsview/writepdf(inside:to:).md)
- [drawPageBorder(with:)](appkit/nsview/drawpageborder(with:).md)
- [drawSheetBorder(with:)](appkit/nsview/drawsheetborder(with:).md)
