I did some research and found that I should be able to convert a PDF into a byte[] and then into a UIImage but so far no luck. The reason for not being able to use CoreGraphics is that I'm using apportable which does not support the CGPDF classes.
I'm able to create a NSData object that seems to contain the PDF but when using that object to create a UIImage the image is nil.
- (instancetype) initWithBackSize: (CGSize) size
{
NSString *path = [[ NSBundle mainBundle ] pathForResource:@"pdfTest.pdf" ofType:nil ];
NSData* pdfData = [NSData dataWithContentsOfFile:path];
UIImage* image = [[UIImage alloc] initWithData:pdfData];
CCTexture* texture = [[CCTexture alloc] initWithCGImage: image.CGImage contentScale: image.scale];
self = [super initWithTexture: texture];
return self;
}
The binary data within a PDF file cannot be translated directly into an UIImage type. You need to find a third party library or some other way of converting a PDF file into an UIImage.