I tried using somewhat simpler printing code, which I've seen work in other apps:
- (IBAction) doPrint: (id) sender
{
NSPrintOperation* printOp = [NSPrintOperation printOperationWithView: _webView];
printOp.jobTitle = @"Help";
NSPrintInfo* info = printOp.printInfo;
info.verticallyCentered = NO;
printOp.printInfo = info;
[printOp runOperationModalForWindow: _webView.window
delegate: self
didRunSelector: nil
contextInfo: nil ];
}
But no go here. I tried the same thing in another window, this one using WKWebView, with the same blank result.
This is a sandboxed app, and the com.apple.security.print entitlement is on.
I'm working in Xcode 15.2 on macOS 13.8.8. I took a project that wouldn't print on this machine to a newer machine running a Tahoe beta, and there it worked. So then I'm asking myself, is printing just broken on this machine? No, printing from other apps shows the preview just fine.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: