1

私は奇妙な問題を抱えています。UIwebview で PDF ファイルが正しく表示されません。Web URL から、または Safari ブラウザーから PDF ファイルをロードすると表示されます。

http://www.winsolz.com/temp/2.jpg

次のコードを使用して、ローカル システムから PDF を開きます。

NSString *pathFOrPDF = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"Page%@", strPDFNumber] ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:pathFOrPDF];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[myWebview loadRequest:request];      
[myWebviewLandscape loadRequest:request]; 

ありがとう。

4

2 に答える 2

0

これは役立つかもしれません。

UIWebView *webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
webView.backgroundColor = [UIColor redColor];
NSString*fileName= @"About_Downloads";
NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@"pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:path     isDirectory:NO]];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];
[self.view addSubview:webView]  

于 2014-05-08T09:38:59.860 に答える