1
是否有本地方式将PDF文档(或至少PDF文档的第一页)转换为图像?如何将PDF转换为图像?
是否有本地方式将PDF文档(或至少PDF文档的第一页)转换为图像?如何将PDF转换为图像?
使用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);
给出了一个零的UIImage我 – jjxtra 2014-05-18 19:47:09