• 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: Saving an annotated PDF to a flat image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Saving an annotated PDF to a flat image (From: Danny Greg <email@hidden>)

  • Prev by Date: Re: Unable to launch about panel for the 2nd time
  • Next by Date: setPrimitiveValue:forKey: and to-many relationships
  • Previous by thread: Saving an annotated PDF to a flat image
  • Next by thread: Re: Saving an annotated PDF to a flat image
  • Index(es):
    • Date
    • Thread