WebView, NSPrintOperation and Leopard
WebView, NSPrintOperation and Leopard
- Subject: WebView, NSPrintOperation and Leopard
- From: Scott Garner <email@hidden>
- Date: Thu, 1 Nov 2007 21:36:25 -0700
Hi All,
I'm the author of a relatively popular Automator action called
"Download URLs as PDFs" and it no longer functions in Leopard. I
believe I have traced the problem, but I'm not sure how to fix it.
When the user chooses to download a paginated PDF, the action
calls NSPrintOperation on the documentView within the webView
and dumps it to a file. This worked fine in Tiger, but apparently
NSPrintOperation in Leopard tries to lock the focus of the view it is
printing, resulting in an assertion failure:
11/1/07 8:09:03 PM Automator[3748] ** INTERNAL ERROR: Uncaught
Exception **
Exception: lockFocus sent to a view which is not in a window
I tried using setHidden:YES on the view in question, which fixed
the error, but it also resulted in blank PDFs. I suppose I could add
the webView to a window, but frankly I'm not sure how to work that
out in Automator.
Here are some snippets:
// Webview Creation
fakeWebView = [[WebView alloc] initWithFrame:NSZeroRect frameName:nil
groupName:nil];
[fakeWebView setFrameLoadDelegate:self];
[fakeWebView setMaintainsBackForwardList:NO];
And later:
// Print Routine
NSPrintOperation *printOp;
printOp = [NSPrintOperation printOperationWithView:printView
printInfo:printInfo];
[printOp setShowPanels:NO];
[printOp runOperation]; // There error happens somewhere in here.
My Cocoa has gotten extremely rusty, so forgive me if I'm missing
something completely obvious.
Thanks,
Scott
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden