views:

60

answers:

2

I'm working with an NSImage which comes from a PDF. When I initially create the image, it has only one NSImageRep and that is NSPDFImageRep. This is good. I can work with it. I can find out how many pages it has, and go to a specified page, and draw it, etc.

The problem is that as soon as I turn my back, it gets turned into a NSCachedImageRep, which doesn't seem to have multiple pages. Now, if I keep the PDFImageRep in a separate variable, it is kept track of, but it isn't associated with the image anymore, so when I draw the image, it's still on the same page.

What am I missing?

thanks.

+2  A: 

You need to call [image setDataRetained:YES] on the image, so that your original PDF data is kept around, otherwise it will be cached to a bitmap.

If you're still having problems you could turn off caching altogether by using [image setCacheMode:NSImageCacheNever].

Rob Keniger
A: 

Try it on 10.6. The problem has probably evaporated.

Please see the AppKit release notes for details of the NSImage changes.

Ken
Those are great, except that I have many users (and a co-worker!) who are still using 10.3!!!
Brian Postow