• 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
Re: NSData from CGPDFPageRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData from CGPDFPageRef


  • Subject: Re: NSData from CGPDFPageRef
  • From: Gustavo Pizano <email@hidden>
  • Date: Thu, 20 May 2010 12:08:03 +0200

Hello Christian

This method was given to me yesterday by Jack Nutting... I dunno if its what you are looking for.




On Wed, May 19, 2010 at 12:07 PM, Gustavo Pizano
<email@hidden> wrote:
> Hello all.
>
> I would want to know if I can render pdf  into iPad using quartz, or I have to use UIWebView... or whats the way to achieve this?
>
>

The basics are very simple:

- (NSData *)pdfDataForView:(UIView *)myView inRect:(CGRect)bounds {
 // set up PDF rendering context
 NSMutableData *pdfData = [NSMutableData data];

 UIGraphicsBeginPDFContextToData(pdfData, bounds, nil);
 UIGraphicsBeginPDFPage();

 // tell our view to draw
 [myView drawRect:bounds];

 // remove PDF rendering context
 UIGraphicsEndPDFContext();

 return pdfData;
}

If you need to do a multipage document, it will get more complicated.

HTH,

--
// jack
// http://nuthole.com
// http://learncocoa.org
On 20.5.2010, at 11:59, Christian Ziegler wrote:

> Hi all,
>
> can anyone think of a way to get an NSData object out of a CGPDFPageRef?
>
> Cheers,
> Chris
> _______________________________________________
>
> 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

  • Follow-Ups:
    • Re: NSData from CGPDFPageRef
      • From: Christian Ziegler <email@hidden>
References: 
 >NSData from CGPDFPageRef (From: Christian Ziegler <email@hidden>)

  • Prev by Date: NSData from CGPDFPageRef
  • Next by Date: Re: NSData from CGPDFPageRef
  • Previous by thread: NSData from CGPDFPageRef
  • Next by thread: Re: NSData from CGPDFPageRef
  • Index(es):
    • Date
    • Thread