Generating PDF images
Generating PDF images
- Subject: Generating PDF images
- From: Graham Cox <email@hidden>
- Date: Fri, 28 May 2010 11:20:12 +1000
What's the current recommended practice for generating a pdf image without reference to any view or existing context? (Has to work on 10.5+)
The situation is that I have an object that can return a preview image of itself which it currently does by rendering into a bitmap graphics context associated with a NSBitMapImageRep, both of which I create on the fly. This is then put into an NSImage and returned.
This approach forces me to choose a resolution up front which is a bit daft because the object itself is a vector graphic, and then the resulting image (which ends up getting used for a variety of purposes such as creating an icon and a QuickLook preview) has a fixed res and is much larger than it needs to be.
So much better if I could just return a PDF image, but Cocoa appears to make this unnecessarily hard.
Can I not create a PDF context, associate that with a NSPDFImageRep instead? It appears I'm forced to use NSPrintOperation to do this which is slightly weird as this has nothing to do with printing, nor do I have a view readily available to attach to the NSPrintOperation. Surely there's a more straightforward way than going round the houses like this?
Pointers to what I should be looking at greatly appreciated.
--Graham
_______________________________________________
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