views:

51

answers:

0

I have used CGContextDrawPDFPage two times in my project. One is for displaying the PDF and the other is for making the thumb image of the PDF.

I am using the PDF to image code from

http://github.com/0xced/pdfrasterize/blob/master/CGPDFAdditions.c

I am calling the PDF to image method like this in my code

NSURL *url = [NSURL fileURLWithPath:filename];  
pdf = CGPDFDocumentCreateWithURL((CFURLRef)url);    
CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
CGImageRef imgRef = CreatePDFPageImage(page, 0.25, true);
UIImage *thmbImage = [UIImage imageWithCGImage:imgRef];
CGImageRelease(imgRef);
CGPDFDocumentRelease(pdf), pdf = NULL;  

The problem is that CGContextDrawPDFPage(context, page) is getting leaked wherever i am using the same.