0
正在处理PDF照片报告应用程序,并在生成的PDF文件中处理低图像质量问题。如何提高pdf中的图像质量?
func drawImage(index: Int, rectPos: Int) {
let image = getImage(index)
let xPosition = CGFloat(rectArray[rectPos][0])
let yPosition = CGFloat(rectArray[rectPos][1])
image.drawInRectAspectFill(CGRectMake(xPosition, yPosition, 325, 244))
}
func getImage(index: Int) -> UIImage {
var thumbnail = UIImage()
if self.photoAsset.count != 0 {
let initialRequestOptions = PHImageRequestOptions()
initialRequestOptions.resizeMode = .Exact
initialRequestOptions.deliveryMode = .HighQualityFormat
initialRequestOptions.synchronous = true
PHImageManager.defaultManager().requestImageForAsset(self.photoAsset[index], targetSize: CGSizeMake(325, 244), contentMode: PHImageContentMode.Default, options: initialRequestOptions, resultHandler: { (result, info) -> Void in
thumbnail = result!
})
}
return thumbnail
}
然后我使用这些函数来获取图像,并将其放置到一个位置,在页面上后UIGraphicsBeginPDFPageWithInfo(页,无)...
我使用BSImagePicker吊舱获得的图像。
最后我photoAsset只是用户从吊舱的的CollectionView选择图片后产生PHAsset照片数组...
到目前为止,我试过了initialRequestOptions.deliveryMode所有设置...高质量似乎不会使图像更好。
我在这里做错了什么?谢谢!