- - (UIImage *)p_w_picpathFromPDFWithDocumentRef:(CGPDFDocumentRef)documentRef {
- CGPDFPageRef pageRef = CGPDFDocumentGetPage(documentRef, 1);
- CGRect pageRect = CGPDFPageGetBoxRect(pageRef, kCGPDFCropBox);
- UIGraphicsBeginImageContext(pageRect.size);
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextTranslateCTM(context, CGRectGetMinX(pageRect),CGRectGetMaxY(pageRect));
- CGContextScaleCTM(context, 1, -1);
- CGContextTranslateCTM(context, -(pageRect.origin.x), -(pageRect.origin.y));
- CGContextDrawPDFPage(context, pageRef);
- UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return finalImage;
- }
pdf首页封面的抓取
精选 转载荣保红 博主文章分类:iphone/ipad 开发
文章标签 职场 iphone 休闲 pdf首页封面的抓取 文章分类 后端开发