Re: Saving an annotated PDF to a flat image
Re: Saving an annotated PDF to a flat image
- Subject: Re: Saving an annotated PDF to a flat image
- From: John Calhoun <email@hidden>
- Date: Wed, 24 Sep 2008 12:34:16 -0700
On Sep 23, 2008, at 4:11 AM, Danny Greg wrote:
I am trying to save a PDF annotated using subclasses of
PDFAnnotation to an image (such as a png, jpg etc) or a PDF such
that the annotations are displayed. So the resulting image should be
annotated.
Not too much code.....
Get the size of said page (-[PDFPage boundsForBox:]) and create an
NSImage of this size (-[[NSImage alloc] initWithSize:]). Lock the
image (-[NSImage lockFocus]) and then call PDFPage;s draw method (-
[PDFPage drawWithBox:]). Unlock focus on the NSImage and you;re done.
This is off the top of my head so I haven't tested the code.
Oh, you may need to throw in a -[PDFPage transformContextForBox:] so
it works with PDF's with rotated pages, etc.
John Calhoun—_______________________________________________
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