Getting PDF data from a webView
Getting PDF data from a webView
- Subject: Getting PDF data from a webView
- From: Jon Hull <email@hidden>
- Date: Wed, 18 Jul 2007 09:48:29 -0700
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