Re: Creating WebView in code
Re: Creating WebView in code
- Subject: Re: Creating WebView in code
- From: Jenny M <email@hidden>
- Date: Thu, 1 Apr 2010 19:17:12 -0700
> Not an NSRect, but you can get an NSSize from [[NSPrintInfo sharedPrintInfo] paperSize]. From that, you can build an NSRect with that value for the size and NSZeroPoint for the origin.
>
Great, I'm testing that method now. I get everything built alright,
but during the print operation (while the print panel is shown), the
program crashes with the following message in the console:
-----------------
Debugger() was called!
The Debugger has exited due to signal 2 (SIGINT).The Debugger has
exited due to signal 2 (SIGINT).
-----------------
Now, when the print panel IS shown, the preview is blank, so I know
it's not loading but I can't tell where. Here's the code I'm using..
------------------
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSSize pageSize = [printInfo paperSize];
NSRect frame = NSMakeRect(0.0, 0.0, pageSize.width, pageSize.height);
WebView *myWebView = [[WebView alloc] initWithFrame:frame
frameName:@"Test Frame" groupName:nil];
[[myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://nytimes.com"]]];
NSView *printView = [[[myWebView mainFrame] frameView] documentView];
[printInfo setVerticallyCentered:NO];
[printInfo setHorizontalPagination:NSFitPagination];
NSPrintOperation *printOperation = [NSPrintOperation
printOperationWithView:printView];
[printOperation runOperation];
------------------
If I can't get this to work, I'll go to a NIB file, but I'd really
like to avoid that if possible...
Thanks in advance....
_______________________________________________
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