<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/dataWithPDF(inside:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)dataWithPDFInsideRect:"
  },
  "title" : "dataWithPDF(inside:)"
}
-->

# dataWithPDF(inside:)

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

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

## Parameters

`rect`

A rectangle defining the region.

## Discussion

This data can be placed on an [`NSPasteboard`](/documentation/AppKit/NSPasteboard) object, written to a file, or used to create an [`NSImage`](/documentation/AppKit/NSImage) object.

---

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)