UIView using Quartz rendering engine to display PDF has poor quality compared to original.

Posted by Josh Kerr on Stack Overflow See other posts from Stack Overflow or by Josh Kerr
Published on 2009-10-20T22:58:47Z Indexed on 2010/04/06 3:03 UTC
Read the original article Hit count: 697

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. :(

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-3.0