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.

Brian Postow
  • 11,709
  • 17
  • 81
  • 125

2 Answers2

2

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
  • 45,830
  • 6
  • 101
  • 134
0

Try it on 10.6. The problem has probably evaporated.

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

Ken
  • 12,933
  • 4
  • 29
  • 32