views:

222

answers:

2

How can I scale the content of a WebView?

A: 

A WebView is an NSView, so one way would be to send it a scaleUnitSquareToSize: message.

Peter Hosey
Because a WebView is actually a fairly complex set of managed nested views, you actually can't just call `-scaleUnitSquareToSize:` on the main `WebView` object.
Rob Keniger
+1  A: 

You need to call -scaleUnitSquareToSize: on the document view of the individual frame that you want to resize, for example the main frame:

[[[[webView mainFrame] frameView] documentView] scaleUnitSquareToSize:NSMakeSize(1.5, 1.5)];
[[[[webView mainFrame] frameView] documentView] setNeedsDisplay:YES];
Rob Keniger