How to READ/PARSE the PDF contents loaded in an UIWEBVIEW - iphone

Assume the situation, i have an UIWebView and signed in into my gmail account, i have received an e-mail with an attached pdf file. Now am clicking on the attachment link the webview will open the pdf file there itself.
At this time if am trying to read the html contents it returns NULL.
Please help me by giving an idea. Now how could i read/parse that pdf content already loaded in webview and store the data into NSString.

if you have the URL for the PDF file then directly load the URL in the WebView otherwise you have to use the NSURLRequest to download the file and then load the file from the local directory of the application. I shall be glad to provide you with the code of loading the PDF file from the local directory however I suggest you to google it.

Related

Why is the raw url of pdf file in github can't be open with browser directly instead of download

I tried pdf, txt and png file url, only pdf url can't be open with browser if click the url, but trigger download.
I google this but only got how to fix, like instead with google doc or use pdf.js, or other html code.
What is the reason? the website ? Forgive me that i have no idea of website architecture.
When you get a file from a website, it has a content type sent along with it. Depending on the content type, the browser may choose to display it. For example, content type "application/pdf" might be shown in a browser, but "application/octet-stream" will be downloaded.
The raw URL on GitHub has content type "application/octet-stream" (a binary file) so that it will be downloaded.
The only way around this, since you can't change GitHub's code that sets the content type, is to get the data from JavaScript and parse it there -- by using pdf.js or something similar.

Remote s3 Pdf file not opening in webview.

Pdf file Uploaded to amazon s3 bucket is not visible when open on UIWebView. When tried to open it on Browser the file gets downloaded.
While uploading the pdf file on S3 bucket, specify the file type to PDF. And then the resulting url will open the pdf on both browser and UIWebView

Load UIWebView's Contents into Email Message

I have a UIWebView in my view controller. This UIWebView shows a PDF file. I have created a button. When the user clicks on this button, I want to send the content of the UIWebView via email. As a template I use the MailComposer from Apple. In this template Apple isn't using a UIWebView. Apple uses local stored data which works fine. So I am looking to send the content of the UIWebView, my displayed PDF, but I don't know how to do this.
Thanks.
You could try using -stringByEvaluatingJavaScriptFromString: to get the HTML content of the page and using -setMessageBody:isHTML: to set the message body. You may want use a <base /> tag, though, to set the page's base URL so relative URLs function.
Edit
You could download the PDF and use addAttachmentData:mimeType:fileName: to attach the PDF to an email.
What you will need to do is download the pdf and save it on the device and then attach it as per Apple' example.
see one approach to downloading here

obtaining name of pdf

thanks in advance
i have application in which i download pdf as a attachment through email account like gmail.com and it will be saved in tableview as one static name like attachment all this is runnable
now i want that during downloading of pdf i have to save with some name which is display in gmail account so how how can i do this i want to save that name which is show with attachment name like compansionFishpdf- print
When you download the PDF file, save it with that name. I usually pass a parameter "filename" from the server to the app when it downloads a file, but I don't know what kind of server language you're using.

Open pdf file from the server in GWT

I want to open a pdf file from a button of my GWT application. Actually to access that file I've to query the server that returns the file encoded in base64 from a JSON request.
It's possible to open that file then?
To show a pdf "file" (it's not a file, but a byte stream in http reply) you need to rely on browsers own capability to render pdf data. To do this you must either open a URL in a new window or in in an iframe. The second is probably a better option when using GWT. Docs of the GWT Frame.
// url of the pdf (must have application/pdf content-type)
Frame frame = new Frame("url");
// add the frame wherever you want
RootPanel.get().add(frame);
In order for the browser to correctly display pdf page (by invoking the pdf plugin), the url that serves the pdf data must have a header that says Content-Type: application/pdf. Check that your response has this header.