<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/runModalPageLayout(with:delegate:didRun:contextInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(im)runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:"
  },
  "title" : "runModalPageLayout(with:delegate:didRun:contextInfo:)"
}
-->

# runModalPageLayout(with:delegate:didRun:contextInfo:)

Runs the modal page layout panel with the receiver’s printing information object.

```
func runModalPageLayout(with printInfo: NSPrintInfo, delegate: Any?, didRun didRunSelector: Selector?, contextInfo: UnsafeMutableRawPointer?)
```

## Parameters

`printInfo`

The `NSPrintInfo` object for the page layout panel to use.

`delegate`

The delegate to which the selector message is sent.

`didRunSelector`

The selector of the message sent to the delegate.

`contextInfo`

Object passed with the callback to provide any additional context information.

## Discussion

Invoked from the action method [`runPageLayout(_:)`](/documentation/AppKit/NSDocument/runPageLayout(_:)). Presents the page layout panel app modally if there is no document window to which it can be presented document modally.

When the panel is dismissed, `delegate` is sent a `didRunSelector` message. The `didRunSelector` callback method should have the following signature:

```objc
- (void)documentDidRunModalPageLayout:(NSDocument *)document accepted:(BOOL)accepted  contextInfo:(void *)contextInfo
```

---

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)