iPad UIWebView PDF rendering is giving me weird visual artifacts

Posted by ashwhite on Stack Overflow See other posts from Stack Overflow or by ashwhite
Published on 2010-04-18T00:12:05Z Indexed on 2010/04/18 0:23 UTC
Read the original article Hit count: 1105

Filed under:
|
|
|

I am having some difficulty using a UIWebView to render PDF files on the iPad. Everything works fine in portrait mode, but turning the device to landscape produces strange visual quirkiness. Zooming in (but not out) even the slightest will correct it, but obviously that's not an ideal workaround.

The issue occurs with any PDF file (I have tried several, all stored locally in the bundle, not retrieved from the web). I also created a clone of the project for iPhone, which seems to work just fine, so the problem is iPad-specific. The problem occurs both in the simulator as well as on a physical iPad.

Screenshot

http://dev.boxkite.net/images/ipad/ipad-pdf.png

Code

NSString* filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]; NSData* data = [NSData dataWithContentsOfFile:filePath];

[self.webView loadData:data MIMEType:@"application/pdf" textEncodingName:@"UTF-8" baseURL:nil];

Thanks so much for your time.

© Stack Overflow or respective owner

Related posts about ipad

Related posts about ipad-sdk