Printing with a WebView
Printing with a WebView
- Subject: Printing with a WebView
- From: Frédéric Testuz <email@hidden>
- Date: Sat, 16 Oct 2004 18:11:07 +0200
Hello,
I have a program to edit some data. Now I want to print the data in
different forms and I have think of the WebView. Create the html code
is not difficult and you can customize the style easily with css. (And
I have never draw things, so using a view who is doing the job is
easier :-)
It's the first time I print something in a cocoa program. I have some
difficulties with the dimensions of the view.
I set the width with infos from the document printInfo, but for the
height I can't find a way to obtain the bound height of the view which
draw the html code. Here is my code:
- (void)printShowingPrintPanel:(BOOL)flag
{
WebView *myView;
NSPrintInfo *pi=[self printInfo];
myView =[[WebView alloc] initWithFrame:NSMakeRect(0, 0, [pi
paperSize].width-[pi leftMargin]-[pi rightMargin], 500)];
[[myView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:@"file:///Users/myuser/Sites/index.html"]]];
[myView setFrameSize:NSMakeSize(aWidth, aHeight)]; // <-- here,
aHeight=???
NSPrintOperation *po=[NSPrintOperation printOperationWithView: myView];
[po setShowPanels:flag];
[po runOperation];
[myView release];
}
If anyone has an idea ? Thanks.
--
Frédéric Testuz
<
mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden