---
title: "handlePrint(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocument/handleprint(_:)"
---

# handlePrint(_:)

Handles the Print AppleScript command by attempting to print the document.

## Declaration

```swift
func handlePrint(_ command: NSScriptCommand) -> Any?
```

## Parameters

- `command`: An AppleScript command object.

## Discussion

Discussion Extracts Print command arguments from the command object and uses them to determine how to print the document—specifically, any print settings and whether to show the Print dialog. A Print AppleScript command may specify more than one document to print. If so, a message is sent to each document.

## See Also

### Handling Script Commands

- [handleClose(_:)](appkit/nsdocument/handleclose(_:).md)
- [handleSave(_:)](appkit/nsdocument/handlesave(_:).md)
- [objectSpecifier](appkit/nsdocument/objectspecifier.md)
- [lastComponentOfFileName](appkit/nsdocument/lastcomponentoffilename.md)
