---
title: "runModalPageLayout(with:delegate:didRun:contextInfo:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocument/runmodalpagelayout(with:delegate:didrun:contextinfo:)"
---

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

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

## Declaration

```swift
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

Discussion Invoked from the action method 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: - (void)documentDidRunModalPageLayout:(NSDocument *)document accepted:(BOOL)accepted  contextInfo:(void *)contextInfo

## See Also

### Printing the Document

- [printInfo](appkit/nsdocument/printinfo.md)
- [preparePageLayout(_:)](appkit/nsdocument/preparepagelayout(_:).md)
- [runModalPrintOperation(_:delegate:didRun:contextInfo:)](appkit/nsdocument/runmodalprintoperation(_:delegate:didrun:contextinfo:).md)
- [shouldChangePrintInfo(_:)](appkit/nsdocument/shouldchangeprintinfo(_:).md)
- [print(withSettings:showPrintPanel:delegate:didPrint:contextInfo:)](appkit/nsdocument/print(withsettings:showprintpanel:delegate:didprint:contextinfo:).md)
- [printOperation(withSettings:)](appkit/nsdocument/printoperation(withsettings:).md)
- [pdfPrintOperation](appkit/nsdocument/pdfprintoperation.md)
- [saveToPDF(_:)](appkit/nsdocument/savetopdf(_:).md)
