---
title: "application(_:printFile:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplicationdelegate/application(_:printfile:)"
---

# application(_:printFile:)

Returns a Boolean value that indicates if the app prints the specified file in its entirety.

## Declaration

```swift
@MainActor optional func application(_ sender: NSApplication, printFile filename: String) -> Bool
```

## Parameters

- `sender`: The application object that is handling the printing.
- `filename`: The name of the file to print.

## Return Value

Return Value true if the file was successfully printed or false if it was not.

## Discussion

Discussion This message is sent directly by theApplication to the delegate. The application terminates (using the terminate(_:) method) after this method returns. If at all possible, this method should print the file without displaying the user interface. For example, if you pass the -NSPrint option to the TextEdit application, TextEdit assumes you want to print the entire contents of the specified file. However, if the application opens more complex documents, you may want to display a panel that lets the user choose exactly what they want to print.

## See Also

### Related Documentation

- [application(_:openFileWithoutUI:)](appkit/nsapplicationdelegate/application(_:openfilewithoutui:).md)

### Printing

- [application(_:printFiles:withSettings:showPrintPanels:)](appkit/nsapplicationdelegate/application(_:printfiles:withsettings:showprintpanels:).md)
- [NSApplication.PrintReply](appkit/nsapplication/printreply.md)
