Iphone Open With in a UIWebView - iphone

is it possible to show a PDF in a UIWebView with the option Open in Books and Open With at the top of the WebView? I don't know how to do that.
Thanks

Put a UIDocumentInteractionController on top of the web view, it will allow the user to open the pdf in iBooks.

NSString * path = [[NSBundle mainBundle] pathforResource:#"ResourceName" ofType:#"pdf"] ;
or path can be any http url too.
NSURL * url = [NSURL fileURLWithPath:path];
NSURLRequest * request = [NSURLRequest requestWithURL:url];
UIWebView * webView = ....;
[webView loadRequest:request];
This should show the pdf in webview. But seems you are asking to open the pdf in some other app, which part I didn't understand completely. Can you explain?

Related

How to load large size PDF scroll view in iOS?

I have pdf of size 53MB when i try to load only one page of PDF in scrollview i got memory warning and then application crash.
Display the PDF in a UIWebView:
NSString *PDFPath = [[NSBundle mainBundle] pathForResource:#"filename" ofType:#"pdf"];
NSURL *URL = [NSURL fileURLWithPath:PDFPath];
NSURLRequest *URLRequest = [NSURLRequest requestWithURL:URL];
[webView loadRequest:URLRequest];
The WebView will load pages into memory as they appear on screen rather than all at once.
This is a duplicate of What is the best way to view large PDFs on iOS?
The accepted answer is to use a UIWebView as indicated above.
You should take a look at the vfr/Reader, which is a PDF Reader Core for iOS.
UIWebView is not very good in handling big files out of the box.

PDF preview like Mail App

I am looking for a PDF preview feature similar to the one available when a PDF is received via mail in iPad mail app. It has options like Print/Mail and an Open In menu. Do you have any idea is it an apple's custom implementation or part of framework. I couldn't find in QLPreviewController and UIDocInteract framework.
its very simple to implement .. you will just load NSURLRequest with the NSURL that hold the pdf path into UIWebView.
for example :
NSString *pdfPath = [[NSBundle mainBundle] pathForResource:#"iPadHIG" ofType:#"pdf"];
NSURL *pdfUrl = [NSURL fileURLWithPath:pdfPath];
[webView loadRequest:[NSURLRequest requestWithURL:pdfUrl]];
webView.scalesPageToFit = YES;

I am trying to open a webpage on the UIWebView

I am trying to open a webpage on the UIWebView which is secured. I am getting that error message also. But if i try to open it in safari it is giving an alert and i can continue from there forcefully. How can i implement that using UIWebView
Thanks in advance
I am not clear with your question but i understood something like you want to load a web page in UIWebView some of the snippet may use for you
UIWebView *loacalWebView=[[uiwebView alloc]initwithFrame:self.view.frame];
loacalWebView.delegate=self;
NSString *urlAddress = #"http://www.google.co.in";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[loacalWebView loadRequest:requestObj];

how to show rss feed url in UIWebView in iphone sdk?

I am trying to display url in UIWebView but I can not display, webview just call the fail with error method. My url is this "http://www.tekniknoktamarket.com/index.php?route=feed/google_base",
So please help me how to display this url in UIWebView *?*
In order to have a UIWebView download and display the content from a URL, you need to go through a couple of layers of abstraction, the first being an instance of NSURL, which contains your URL string. Then, you hand the NSURL to an instance of NSURLRequest. Finally, you hand the NSURLRequest to the webView. It all looks something like this:
NSURL *url = [NSURL URLWithString:#"www.your-url.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[yourWebView loadRequest:request];
That should do it.
This is the code loading a URL into a webview:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.theurl.com"]]];
If you're using this code and are encountering any problems, please provide the code you were using and the exact error

how to get a web page displayed on my uiwebview in objective -c

I am trying to display a web page in UIWebView so that when i click a button the webpage should be displayed in uiWebview.How could this be possible Can anybody help in solving this or give me some hint
You should have a look at the documentation for UIWebView.
There are two ways of doing this. The method you choose depends on where the data is coming from. If you're loading the data from a string, use:
NSURL* base = [NSURL URLWithString: #"http://..."];
[myWebView loadHTMLString: #"some html here" baseURL: base];
When loading HTML from a string the UIWebView needs to know the base URL for any relative URLs within the document, hence the baseURL: parameter.
If the data is accessible via a URL, use:
NSURL* url = [NSURL URLWithString: #"http://..."];
NSURLRequest* request = [NSURLRequest requestWithURL: url];
[myWebView loadRequest: request];