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

# printDocument(_:)

Prints the receiver in response to the user choosing the Print menu command.

```
@IBAction func printDocument(_ sender: Any?)
```

## Parameters

`sender`

The control sending the message.

## Discussion

An `NSDocument` object receives this action message as it travels up the responder chain. The default implementation invokes [`print(withSettings:showPrintPanel:delegate:didPrint:contextInfo:)`](/documentation/AppKit/NSDocument/print(withSettings:showPrintPanel:delegate:didPrint:contextInfo:)).

## See Also

[`printInfo`](/documentation/AppKit/NSDocument/printInfo)

The printing information associated with the document.

[`-  shouldChangePrintInfo:`](/documentation/AppKit/NSDocument/shouldChangePrintInfo(_:))

Returns a Boolean value that indicates whether the document allows changes to the default printing information.



---

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)