I'm trying to create a thumb preview of a PDF's pages and store them on disk as PNGs. This is supposed to run in a separate thread and not on the UI thread.
To achieve this I'm using CGContextRef
to draw the PDF page, then get a CGImage
from it, convert that to a UIImage
, get a PNG from it (which will be NSData
) and save that NSData
to disk. All clear so far.
However CGImage
and UIImage
are a UI elements and should not be used on another thread - but I don't want to bring that image on screen ever. Is it okay to use them on another thread in that case? Or is there another way to render a PDF page preview directly to disk?