Trouble with NSDocument-based App Printing Custom Views on macOS 13.6
I've encountered a strange issue with I'm sure I'm missing something obvious here, but I'm working on a personal project and I'm currently developing an NSDocument-based application, and I'm working with an scenario when trying to print a custom view... When I call `NSPrintOperation`, it seems to ignore the customizations I've applied to the view. Instead, it prints a blank page. Iโve set up my `NSPrintInfo` correctly and ensured that the custom view is being rendered properly on the screen. Hereโs a snippet of the printing code: ```swift let printInfo = NSPrintInfo.shared.copy() as! NSPrintInfo printInfo.horizontalPagination = .fit printInfo.verticalPagination = .fit printInfo.isHorizontallyCentered = true printInfo.isVerticallyCentered = true let printOperation = NSPrintOperation(view: myCustomView, printInfo: printInfo) printOperation.run() // This seems to result in a blank page ``` Iโve verified that `myCustomView` has the correct content by rendering it on the screen and also by logging its frame size just before initiating the print operation. The view does not appear to be nil or empty. Also, I tried calling `layoutSubtreeIfNeeded()` right before the print operation, but that didnโt change the outcome. The scenario continues when I try printing from both the Simulator and a real device running macOS 13.6. Iโm also seeing no errors or exceptions in the console during the print operation, which makes this a bit perplexing. Is there something I might be missing in the setup or configuration that could lead to this behavior? Any insights would be greatly appreciated! Any ideas what could be causing this? Any help would be greatly appreciated!