UIView using Quartz rendering engine to display PDF has poor quality compared to original.
- by Josh Kerr
I'm using the quartz rendering engine to display a PDF file on the iphone using the 3.0 SDK. The result is a bit blurry compared to a PDF being shown in a UIWebView. How can I improve the quality in the UIView so that I don't need to rewrite my app to use the UIWebView. I'm using pretty much close to the example code that Apple provides.
Here is some of my sample code:
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextSaveGState(gc);
CGContextTranslateCTM(gc, 0.0, rect.size.height);
CGContextScaleCTM(gc, 1.0, -1.0);
CGAffineTransform m = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, rect, 0, false);
CGContextConcatCTM(gc, m);
CGContextSetGrayFillColor(gc, 1.0, 1.0);
CGContextFillRect(gc, rect);
CGContextDrawPDFPage(gc, page);
CGContextRestoreGState(gc);
Apple's tutorial code actually results in a blurry PDF view as well. If you drop the same PDF into a UIWebView you'll see it is actually sharper. Anyone have any ideas? This one issue is holding a two year development project from launching. :(