0

i have pdf file name now i want to open that pdf file from my ipad device with compatable application...

NSString *fileurl=[FILE_URL_Array objectAtIndex:indexPath.row];
NSArray *parts = [fileurl componentsSeparatedByString:@"/"];
NSString *filename = [parts lastObject];

NSString *extn =[filename pathExtension];

NSLog(@"file extn is %@",extn);

NSURL  *url = [NSURL URLWithString:fileurl];

NSLog(@"not existing url is %@",url);
NSData *urlData = [NSData dataWithContentsOfURL:url];

now i want to open this file in my ipad device..when i click on it..can any one have idea?...Thanks in advance

Shaik Tamim
  • 95
  • 12

4 Answers4

0

You can use UIwebview to load it. Check out the answers on this post a while back. opening pdf

Community
  • 1
  • 1
HarmVanRisk
  • 203
  • 1
  • 8
0

you can load your pdf on webview

NSURLRequest *req = [[NSURLRequest alloc] initwithUrl:url];
[self.webview loadRequest:req];
Satyanarayana
  • 1,059
  • 6
  • 16
0

Might be help you...

// Your code
NSString *fileurl=[FILE_URL_Array objectAtIndex:indexPath.row];
NSArray *parts = [fileurl componentsSeparatedByString:@"/"];
NSString *filename = [parts lastObject];

NSString *extn =[filename pathExtension];

NSLog(@"file extn is %@",extn);

NSURL  *url = [NSURL URLWithString:fileurl];

// Take a web view and load the url in the web view
NSURLRequest *request = [NSURLRequest url];
dispatch_async(dispatch_get_main_queue(), ^{

    [_webView loadRequest:request];  // UIWebView object declared globally

});

Happy coding...

Sailendra
  • 1,318
  • 14
  • 29
0

PDF file can open by UIWebView and WKWebView, you just load the PDF file by a NSURL.

Johnny
  • 1,112
  • 1
  • 13
  • 21