• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting PDF data from a webView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Getting PDF data from a webView
      • From: Alastair Houghton <email@hidden>
    • Re: Getting PDF data from a webView
      • From: Jon Hull <email@hidden>
  • Prev by Date: Re: Sorting issues with NSTableView
  • Next by Date: Re: Maintaining a List of instances of a class
  • Previous by thread: Re: Tracking Rectangle Bounds
  • Next by thread: Re: Getting PDF data from a webView
  • Index(es):
    • Date
    • Thread