Skip navigation.
 
mlRe: Create a PDFPage instance from Quartz-format image
FROM : John Calhoun
DATE : Mon Mar 03 20:41:27 2008

On Mar 3, 2008, at 3:06 PM, Scott.D.R wrote:
> However, I want to know whether it is possible to create the PDFPage 
> instance directly from the CGImage, CIImage and so on?


Yes.  The best way to be sure is to subclass PDFPage.

Your subclass should implement -[drawWithBox:] and -[boundsForBox:]. 
Other methods you may want to subclass are optional (an init method 
for example so you have a hook to set up your unique instance 
variables).

Your bounds method needs to return the bounds for the page in points 
for the given box passed in (likely you can return the same bounds for 
all boxes).

And it is in your draw method that you draw your PDF content in "page 
space" (that is, assume 1 pixel equals one point — you need not scale 
or rotate since the viewer - PDFView for example - will be applying 
the needed transform).

Want to make your PDFPage CGImage backed?  Draw the CGImage in your 
draw method.  It's that simple.

There is a sample app or two floating around somewhere that illustrate 
this:  PDFCalendar and PDF Watermarker I believe.

John Calhoun—_______________________________________________

Cocoa-dev mailing list (<email_removed>)

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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlRe: Create a PDFPage instance from Quartz-format image John Calhoun Mar 3, 20:41
mlCreate a PDFPage instance from Quartz-format image Scott.D.R Mar 4, 00:06