On 26 Aug, 2013, at 18:49 , Graham Cox <graham....@bigpond.com> wrote:

> I'm working on a parser that needs to be able to extract graphics from PDF 
> files. So far, I'm making good headway with the CGPDFxxx functions.
> 
> I have a question about extracting embedded bitmap images. When I encounter 
> an XObject stream with subType /Image, I get a bunch of parameters that looks 
> pretty close to the parameters to CGImageCreate. However, the 'Filter' 
> parameter indicates /FlateDecode so I'm assuming that I can't just wrap the 
> stream in a CFDataRef and then in a CFDataProvider - I'll need to actually 
> decompress this data first using (according to PDF spec) zlib/deflate.
> 
> Am I right? Anyone got any sample code or hints regarding how to go about 
> this?

No, you shouldn't need to decompress it. Something like the following should 
get you the data:

[…snip…]
                imageDataPtr = CGPDFStreamCopyData(dataStream, &format);
                dataProvider = CGDataProviderCreateWithCFData(imageDataPtr);
                CFRelease(imageDataPtr);
[…snip…]

Message me privately if you want some more help with this Graham.

-António

----------------------------------------------------
Energy is like a muscle,
it grows stronger through being used.
----------------------------------------------------


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to