Reputation: 481
How can I open downloaded files (images, pdf, word, excel, etc.) in my iOS app? Is there any way to open them using device's system tools like iBooks or this should be done in UIWebView? Example.
Upvotes: 0
Views: 1128
Reputation: 1325
Try this
NSString* pdfFile = @""; //path of file here
NSURL *url = [NSURL fileURLWithPath:pdfFile];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];
[self.view addSubview:webView];
Upvotes: 3
Reputation: 4244
You could use QLPreviewController
class.
The apple documentation link is https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html
Apple Says
A QLPreviewController object, or Quick Look preview controller, provides a specialized view for previewing an item.
EDIT:
A nice tutorial about it:
http://iosdevelopertips.com/data-file-management/preview-documents-with-qlpreviewcontroller.html
Upvotes: 1