![iOS显示PDF iOS显示PDF](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
使用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(,,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];
}