我正在尝试使用此解决方案将 pdf 文件转换为图像:
CFURLRef urlRef = (CFURLRef)[NSURL fileURLWithPath:@"http://uat.okitoo.fr/document/document/s595_506cb1811852f/o_specimen-page-seule.pdf"];
CGImageSourceRef src = CGImageSourceCreateWithURL(urlRef, NULL);
NSDictionary* options = [NSDictionary dictionaryWithObject:(id)[NSNumber numberWithInt:500] forKey:(id)kCGImageSourceThumbnailMaxPixelSize];
CGImageRef firstPage = CGImageSourceCreateImageAtIndex(src, 0, (CFDictionaryRef)options);
UIImage* imagePDF = [UIImage imageWithCGImage:firstPage];
CGImageRelease(firstPage);
我的 pdf 文件没问题,但是当我尝试此代码时,图像没有出现,并且我收到以下消息:“:ImageIO:CGImageSourceCreateImageAtIndex 图像源参数为零”。看不懂。。
我尝试了其他链接,但我有同样的问题..
有任何想法吗 ?还有其他方法可以将我的 pdf 文件转换为图像吗?
非常感谢 !