Reputation: 645
we are building up iOS application in which we are converting pdf into png and then we are showing png. PDF to Png conversion is all fine. But there are some problem in saturation of colors.
I also tried to open up the pdf directly in Safari and it results in same saturation of color problems. Is there a way we can control the colors of PDF ?
Following is the code for coversion of pdf page into image:
CGRect cropBox = CGPDFPageGetBoxRect(page, kCGPDFCropBox);
int pageRotation = CGPDFPageGetRotationAngle(page);
if ((pageRotation == 0) || (pageRotation == 180) ||(pageRotation == -180)) {
UIGraphicsBeginImageContextWithOptions(cropBox.size, NO, resolution / 72);
}
else {
UIGraphicsBeginImageContextWithOptions(CGSizeMake(cropBox.size.height, cropBox.size.width), NO, resolution / 72);
}
CGContextRef imageContext = UIGraphicsGetCurrentContext();
[PDFPageRenderer renderPage:page inContext:imageContext];
UIImage *pageImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Upvotes: 1
Views: 499
Reputation: 5834
At this moment there is nothing you can do. Probably your PDF files contain CMYK images and iOS does not include a device calibrated CMYK profile so when CMYK is converted to RGB the colors appear quite different.
Upvotes: 1