title: White border when rendering PDF when scale > 1
body: <p>I have a method that return an <code>UIImage</code> from a <code>CGPDFPageRef</code>. You can specify a width for the image.</p>
  
  <p>The problem is that when <code>pdfScale</code> is > 1, a white border appears in the image. So the PDF is always drawn at scale 1 with a border instead of a bigger scale. Smaller scales are OK.</p>
  
  <p>I've tried to change the type of PDFBox but that doesn't seems to change anything and the documentation is not really clear.</p>
  
  <p>Does somebody sees the error?</p>
  
  <pre><code>- (UIImage*) PDFImageForWidth:(CGFloat) width {
      CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFCropBox);
      CGFloat pdfScale = width/pageRect.size.width;
      pageRect.size = CGSizeMake(pageRect.size.width*pdfScale, pageRect.size.height*pdfScale);
      pageRect.origin = CGPointZero;
  
      UIGraphicsBeginImageContext(pageRect.size);
      CGContextRef context = UIGraphicsGetCurrentContext();
  
      CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0);
      CGContextFillRect(context, pageRect);
  
      CGContextTranslateCTM(context, 0.0, pageRect.size.height);
      CGContextScaleCTM(context, 1.0, -1.0);
      CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, pageRect, 0, true));
  
      CGContextDrawPDFPage(context, page);
      UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
  
      return image;
  }
  </code></pre>