Re: setting minimum size for NSView to display all content without scroll view
Re: setting minimum size for NSView to display all content without scroll view
- Subject: Re: setting minimum size for NSView to display all content without scroll view
- From: Warwick Hall <email@hidden>
- Date: Sun, 29 Apr 2007 14:22:57 +1000
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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