To view pdf file in web view - android

Here is my question:- I have many pdf files in my application in files folder.I want to display them on web view when user clicks on its hyperlink from another web view.
That is I have one web view which dynamically generates a html page from html template stored in asset folder.In that there we have one hyperlink of pdf file corresponding to data displayed.When user clicks on hyperlink I want to display it in web view.Can it be possible?
Please reply.
Thanks in Advance.

I think the best way for you is using Google Docs.
You can implement in your application Pdf-viewer from Google Docs.
Just put in your html page following code:
<iframe src="http://docs.google.com/gview?url=http://YOUR-URL&embedded=true" width="500" height="250"></iframe>
You can catch user click and redirect user to special page with Google Docs Pdf-viewer

Related

Make an simple Android App / Webview & local pages

I am trying to build a simple app, using Webview.
I just want to create an app that contains 2 html files (stored in assets folder). At loading, app display page1.html in webview.
On this page, there is a link to page2.html (in html format : href=""). I need this page opens also in webview.
I tried, but when I click on the link, the app closes... I tried href="page2.html", href="file:///android_asset/page2.html"... Nothing works.
Do you have any example of a simple app like this ?
Thanks.

Open Pdf link android

I have to show a PDF file inside my application and the PDF file contains a link inside (this link sends the user to the website).
I am searching for a library that allows me to show the file inside my application and if the user clicks the link, open a browser.
Is it possible?
Thanks in advance! :)
I personally use this one : AndroidPdfViewer
you can use a webview also following this example : Example pdf on webview

Create a working link in TextView, which points to the html file from assets

I have a TextView with HTML text which contains two hyperlinks:
<string name="agreement"><![CDATA[By signing up I agree to Terms of Use, Payment terms and Legal Policy]]></string>
Both links are clickable, but the first one fails to be opened by any viewer on my Nexus 5. Some application appears for a second, then it shuts down and a toast is saying "Cannot display PDF (terms.html cannot be opened)"
How can I make the local hyperlink open HTML file in browser?
Actually you can simply use webview

Downloading a WebView site to an HTM(L) file and showing that in a WebView again

I want to save the current site from my WebView from my app to an HTM(L) file. So when I press a button the current site that is displayed in my WebView, say http://www.google.com, is downloaded to the users phone in an HTM(L) file.
When this file is downloaded I want to display it on another moment in the WebView. I know how to display HTM(L) files in WebView but are there any things I should know.
So how do I download the current webpage from my WebView in an HTM(L) file?
Get the content of WebView: How do I get the web page contents from a WebView?
Write the HTML content in a file, let say index.html: http://www.anddev.org/working_with_files-t115.html
Now you know where the file is located, so read the content of that file and display it in another WebView.

How can I change the way the google docs website displays a PDF in Android?

I am using the following link inside a WebView to show a pdf file in my android application:
http://docs.google.com/gview?embedded=true&url=http://174.136.1.35/dev/android/1_android-Survey-Report-for-pdf-1200-x-768.pdf
This works, and displays the PDF, as you can see in the attached images. The problem I have is that
I want to disable the zoom controls, and the desktop and download
links.
Is this possible, and if so, how?
You are basically opening a web view and loading it with a webpage from the internet, specifically Google Docs. Without some special functionality built into the website, there isn't going to be way to get rid of the extra buttons, links, and labels you're seeing. Instead of this, you could download the PDF that your link is pointing to as a PDF and try to display that directly. There is a stack overflow question on this topic

Categories

Resources