2011-05-22 206 views

回答

5

使用ImageIO.framework你可以做這樣的事情:

CGImageSourceRef src = CGImageSourceCreateWithURL(PDF_URL, NULL); 
NSDictionary* options = [NSDictionary dictionaryWithObject:(id)[NSNumber numberWithInt:500] forKey:(id)kCGImageSourceThumbnailMaxPixelSize]; 
CGImageRef firstPage = CGImageSourceCreateImageAtIndex(src, 0, options); // 0 first page of the pdf 
CFRelease(src); 
UIImage* img = [UIImage imageWithCGImage:firstPage]; 
CGImageRelease(firstPage); 
+0

給出了一個零的UIImage我 – jjxtra 2014-05-18 19:47:09