title: iOS -- Conversion of PDF results in saturation of colors
body: <p>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.</p>
  
  <p>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 ?</p>
  
  <p>Following is the code for coversion of pdf page into image:</p>
  
  <pre><code>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();
  </code></pre>