It's in python ( via PyObjC ), but ought to be grokkable into vanilla
ObjC.
If this has already been mentioned, sorry. But it seems like it
covers a the kind of webkit usage you're up against.
email@hidden
this mesage brought to you by
THE MATTEL AND MARS BARS
QUICK ENERGY CHOCOBOT HOUR
On Apr 29, 2007, at 12:22 AM, Warwick Hall wrote:
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!