Re: Getting PDF data from a webView
Re: Getting PDF data from a webView
- Subject: Re: Getting PDF data from a webView
- From: Jon Hull <email@hidden>
- Date: Wed, 18 Jul 2007 17:59:27 -0700
Hmm... It seems to be a bug in the webKit printing system. When I
try to print to pdf from Safari, I get the same rendering issues.
Does anyone know of a way to get a bitmap representation of an entire
view (even the part hidden by a scrollview) without using an
offscreen window? If not, my current strategy is to have a second
webview (*ick*) in an offscreen window which mirrors the first.
Thanks,
Jon
On Jul 18, 2007, at 9:48 AM, Jon Hull wrote:
I am trying to get a pdf image from a selection in a webView. At
the moment I am just grabbing the whole view. It works fine,
except the layout is wrong. It doesn't seem to be applying the CSS
for some reason. Does anyone know what is going on? How can I get
an image of a webView (including the stuff hidden by the scrollView)?
Here is the Code:
- (void)setPdfDoc:(PDFDocument*)newPdfDoc
{
[newPdfDoc retain];
[pdfDoc release];//does pdfView hold a copy of this (need to
autorelease)???
pdfDoc = newPdfDoc;
[pdfView setDocument: pdfDoc];
}
- (IBAction)snap:(id)sender
{
NSData *viewImageData;
viewImageData=[[[[webView mainFrame]frameView]documentView]
dataWithPDFInsideRect:[[[[webView mainFrame]frameView]documentView]
bounds]];
[self setPdfDoc:[[[PDFDocument alloc] initWithData:viewImageData]
autorelease]];
}
Oh, I had the same problem when just using the webView (instead of
[[[webView mainFrame]frameView]documentView]) but it also grabbed
the scrollbars.
Thanks,
Jon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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