iOS显示PDF
使用UIWebView来显示
//locale file NSString *html = [NSString stringWithContentsOfFile:path1 encoding:NSUTF8StringEncoding error:nil]; [self.webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]]; //或者 NSString *path = [[NSBundle mainBundle] pathForResource:@"document" ofType:@"pdf"]; NSURL *targetURL = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; [webView loadRequest:request]; //remote file - (void) loadRemotePdf { CGRect rect = [[UIScreen mainScreen] bounds]; CGSize screenSize = rect.size; UIWebView *myWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,screenSize.width,screenSize.height)]; webView.autoresizesSubviews = YES; webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); NSURL *myUrl = [NSURL URLWithString:@"http://www.mysite.com/test.pdf"]; NSURLRequest *myRequest = [NSURLRequest requestWithURL:myUrl]; [webView loadRequest:myRequest]; [window addSubview: myWebView]; [myWebView release]; }