Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > WebView's documentView returns nil

WebView's documentView returns nil
Thread Tools
macrophyllum
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Sep 12, 2005, 08:12 AM
 
Hi,

I am trying to get the document view from a webview for printing and I always get nil returned. Here is my code:

//BEGIN CODE
[[_webView mainFrame] loadHTMLString:html baseURL:nil];
[[self window] makeKeyAndOrderFront:nil];
[_webView print:nil];

NSView *documentView = [[[_webView mainFrame] frameView] documentView];
//documentView is nil!?
NSPrintOperation *op = [NSPrintOperation printOperationWithView:documentView];
[op runOperation];
//END CODE

_webView is an outlet that is hooked up to a webview in IB and if I display the window, the webview shows the correct HTML rendering.

Anyone have any suggestions? I am sure I am just over-looking something obvious.
     
macrophyllum  (op)
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Sep 13, 2005, 08:45 AM
 
Figure it out.

I had to wait for the webview to finish loading and then call ...frameView] documentView]

Thanks to those that looked.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:32 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,