<!--
{
  "availability" : [
    "macOS: 10.9.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPDFPanel/beginSheet(with:modalFor:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPDFPanel(im)beginSheetWithPDFInfo:modalForWindow:completionHandler:"
  },
  "title" : "beginSheet(with:modalFor:completionHandler:)"
}
-->

# beginSheet(with:modalFor:completionHandler:)

Presents a document-modal PDF panel.

```
func beginSheet(with pdfInfo: NSPDFInfo, modalFor docWindow: NSWindow?, completionHandler: @escaping (Int) -> Void)
```

## Parameters

`pdfInfo`

The `NSPDFInfo` object describing the parameters to be used when creating the PDF file.

`docWindow`

The window in which the PDF panel will be presented.

`completionHandler`

The block called when the user dismisses the PDF panel.

## Discussion

This method presents a slightly different PDF panel depending on whether the [`requestsParentDirectory`](/documentation/AppKit/NSPDFPanel/Options-swift.struct/requestsParentDirectory) constant is set. If the user dismisses the panel without canceling it, this method updates the [`NSPDFInfo`](/documentation/AppKit/NSPDFInfo) object with any changes the user makes.

---

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)