Re: Create a PDFPage instance from Quartz-format image
Re: Create a PDFPage instance from Quartz-format image
- Subject: Re: Create a PDFPage instance from Quartz-format image
- From: John Calhoun <email@hidden>
- Date: Mon, 3 Mar 2008 11:41:27 -0800
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@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