---
title: "beginSheet(with:modalFor:completionHandler:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nspdfpanel/beginsheet(with:modalfor:completionhandler:)"
---

# beginSheet(with:modalFor:completionHandler:)

Presents a document-modal PDF panel.

## Declaration

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

```swift
func beginSheet(with pdfInfo: NSPDFInfo, modalFor docWindow: NSWindow?) async -> Int
```

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

Discussion This method presents a slightly different PDF panel depending on whether the requestsParentDirectory constant is set. If the user dismisses the panel without canceling it, this method updates the NSPDFInfo object with any changes the user makes.
