I'm using the epublib Android library to read an existing EPUB, and I can't get internal links to work.
One of the chapters has HTML like this
Click here
but when you actually click on it, you get an Android webview error:
The webpage at file:///data/data/com.temp.package/library/epub/9_epub_files/9781484702181.xhtml could not be loaded.
I've tried changing the URL like this but neither works.
Click here
Click here
Is there anything I need to do in particular to get internal links to work?
Related
We have a file server on which we place PDF documents and then embed links to them in a smart device app. Up until recently, using links to the PDF documents starting with http:// worked fine for Android and iPhone users. All could load the PDF file just fine. Then a few months back (approximately) Android phone users started reporting they would get an error when trying to load any PDF. Yet iPhone users had no issues loading the same PDF document. It was verified that these PDF documents (several) were not corrupted and opened fine when placed on another file server.
I have an iPhone so I can't give you the exact error msg received by Android users but to reproduce it, it was along the lines of... click the link to the PDF, a button appears showing View PDF, click that button and several apps appear to choose the app to open the PDF with, click one (like Adobe Reader, or Google Drive) and an error appears stating the file could not be opened and may be corrupted of the wrong syntax.
Tonight I found the solution.
The url to the PDF on all these documents on our server had been like http://...
but when I changed it to https://... it works fine.
I can't find ANYWHERE any mention of a change by Google that this is now a requirement.
My question...
Can someone explain and/or point me to a reference that explains why https must be used in embedded links to PDF documents? It seems like a pretty big deal to make this a requirement and not tell anyone. My searching the internet has so far not turned up anything.
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.
The problem i got in showing PDF is that it will show the old PDF view as i have created new PDF in server. it is not refreshing it . sometimes it show the correct PDf and sometimes it shows the previous generated PDf. As i have deleted the previous Pdf from the server through coding and genrate new PDf through coding but still it shows the old PDF that is not available in webView.I have checked the server database the old file is deleted and new is generated and there is no issue generatin and deleting in server database but with web view or google docs. I have used clear cache , clear history in webview but still its not working.
Please help.
Thanks
As you have already mention that you have used clear cache and clear history it should work. It is strange that it's not working.
You can check one of the following and try:
first put the URL inside the your PC browser and check whether correct pdf is opening if there the proper pdf opening then inside the Mobile browser that pdf has to open.
Inside the mobile go to the setting - Application - Manage Application - Go to your application from there unchecked all the option means(Force stop,clear data, clear cache) and now check once again.
Hope now it works. May be because the page it is stored inside the mobile browser cache that's why it giving such unexpected behavior.
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
I have an app where I've button on a webpage that is rendered inside a webview.
Now on click of button , a pdf file gets downloaded , and the same would then need to be opened inside the same webview.
attach a download listener to the web view and change the url as follows..
"https://docs.google.com/gview?embedded=true&url=https://www.example.com/xxxxxyyyyyxz.pdf"
example
https://docs.google.com/gview?embedded=true&url=https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf
it's a link used to open pdf without downloading it...
I hope it solves your problem..
I've found that the google viewer seems to work within the android browser for viewing online PDF files. You could build a link to your pdf so that it is displayed in the viewer. I've not tried doing that within a WebView though.
UPDATE
The link is dead, there is an explanation of how to get the functionality to still work at this link.
In case this link also dies, here is the relevant section:
While the page is no longer available as it redirects to Google Docs/Drive, you can still use the Google Docs Viewer. Paste this URL in a new tab:
https://docs.google.com/viewer?url=
and then paste the address of the document you want to view online. Here's an example:
https://docs.google.com/viewer?url=http://research.google.com/archive/bigtable-osdi06.pdf
I do not think that the present android chrome based browser can support pdf. There are discussion about the same in android forums ( ex: link1 link2)
Your best bet to show pdf is to have adobe pdf reader for android installed.(or concisely put, not possible in web view)
I don't think any browser other than Chrome supports rendering PDFs without a plugin or third party tool. It's probably easier to let the user use his own app to open PDFs.
I used the IText PDF library mentioned in this thread
Android : Is there any free PDF library for Android for a sample project. You could try getting using this API to get the PDF page as an image. I am not familiar with every aspect of Itext so it might have better way to do this.