ios - UIWebview doesen't display PDF -


i have used code displaying pdf on webview.

webview=[[uiwebview alloc]initwithframe:cgrectmake(0, 0, 320, 480)]; nsstring *path = [[nsbundle mainbundle] pathforresource:@"fonts1" oftype:@"pdf"]; nslog(@"%@",path); nsurl *targeturl = [nsurl fileurlwithpath:path]; nsurlrequest *request = [nsurlrequest requestwithurl:targeturl]; [webview loadrequest:request]; webview.scalespagetofit=yes;  [self.view addsubview:webview]; 

pdf in bundle pdf correctly.

what wrong in code.

try below one

uiwebview *webview = [[uiwebview alloc] initwithframe:cgrectmake(10, 10, 200, 200)];  nsstring *path = [[nsbundle mainbundle] pathforresource:@"document" oftype:@"pdf"]; nsurl *targeturl = [nsurl fileurlwithpath:path]; nsurlrequest *request = [nsurlrequest requestwithurl:targeturl]; [webview loadrequest:request];  [self.view addsubview:webview]; [webview release]; 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -