Skip navigation.
 
mlRe: setting minimum size for NSView to display all content without scroll view
FROM : Warwick Hall
DATE : Sun Apr 29 06:22:57 2007

more clarification:

i am writing a command line tool which (hopefully) will download a 
url (from the web) and using the WebKit APIs, render the html and 
print the rendered content to a file using PostScript 
(EPSPrintOperation etc). For the webkit part i need to create an off 
screen graphics context and a window attached to that context, then a 
webview object and add the webview object to the window's content 
view. then i create and register a WebFrameLoadDelegate object to run 
an EPSPrintOperation when loading is complete. then i run an 
NSRunLoop until the delegate says it is finished.

all ok, except:

i am stuck with a catch 22.
when the print operation saves the render to the file i want, it has 
the bounds i set for the window when i created the window. *not* the 
bounds of the paper. it turns out that no matter what size i set in 
the [[NSWindow alloc] initWithContentRect:...] that is the size of 
the "paper" in the postscript file.
but since i have to create the window before the content is rendered, 
i have to set the bounds before i know what to set the bounds to. so 
i set it to (0,0,500,10000), and that is large enough to hold most of 
the pages i download, but there is always too much white tail below 
the content (read waste of paper when it is printed or faxed).

so what i think i need (unless the above method is not the way to go) 
is:

float height = ?
(!!!!!!!!!!!!!!)

that is it! all i want is to know what minimum height value i need to 
display all the html content, given a page width (which is not 
adjustable since paper comes in a set width), so that i can set the 
height of the nssize of the nsrect for the [window setBounds:] (or 
webframe or webview or whatever) to make this program work!

but because webkit is so non standard KVM/objective C, i cannot get a 
handle on the basic UI elements to send them sizeToFit's and bound's 
messages. give me that or some alternative, and  i will be a happy 
camper! thankx thankx thankx thankx thankx in advance!

warwick

Related mailsAuthorDate
mlsetting minimum size for NSView to display all content without scroll view Warwick Hall Apr 27, 10:11
mlRe: setting minimum size for NSView to display all content without scroll view I. Savant Apr 27, 12:44
mlRe: setting minimum size for NSView to display all content without scroll view Warwick Hall Apr 28, 22:45
mlRe: setting minimum size for NSView to display all content without scroll view I. Savant Apr 28, 22:49
mlRe: setting minimum size for NSView to display all content without scroll view Warwick Hall Apr 29, 06:22
mlRe: setting minimum size for NSView to display all content without scroll view Shamyl Zakariya Apr 30, 23:35