I need open an PDF file that is in an url. I need open it with an PDF Viewer...
It is possible?
Thanks for all.
Best regards.
I suggest using the ChildBrowser plugin and using Google's viewer to actualy open the PDF (since Android doesn't have a default PDF viewer).
So you can open a PDF like this:
onclick='window.plugins.childBrowser.showWebPage(encodeURI("http://docs.google.com/viewer?url=' + pdfLink + '"));
in android (i don't know phonegap) there are many pdf viewer libraries.
like Android-Pdf-Viewer-Library
or Droid Text
or MuPDF
or APV Pdf Viewer
if you develope your application commercial and don't want to pay any money
use first one.
Related
I have pdf file download in my device on known location. I want to display it within my application. I tried several pdf viewer libraries like:
https://github.com/JoanZapata/android-pdfview <--- This is deprecated.
https://github.com/jblough/Android-Pdf-Viewer-Library <--- Does not display pdf properly. I mean it has several issues while loading pdf.
https://github.com/barteksc/AndroidPdfViewer <--- So far best I could find over the internet.
But none of the above work on hyperlinks to navigate to certain header within the file.
I know i can display pdf file in Google drive viewer, but I don't want that.
So anyone can suggest me relevant pdf viewer library in android which I can plug in my project?
Use google doc viewer to view pdf without any external library.
String pdf = "http://www.pdf995.com/samples/pdf.pdf";
webview.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf);
I have the childbrowser plugin installed and working on my Phonegap application. Works fine for websites but I want to instead view PDFs which have been stored in my assets file.
The link I have to the pdf is currently
Test
But when I do this it trys to navigate to
http://file://android_asset/pdf/Starting-Out_master.pdf
How can I change the link to view the prepackaged PDFs?
You cannot open a PDF using the ChildBrowser. You will need to use the PDF Viewer plugin. Here is a link, sorry that it is in Italian you'll have to use Google Translate or something similar.
http://www.giovesoft.com/2011/08/download-and-open-pdf-with-phonegap.html
Using the WebIntent plugin may also work. Most (but not all) Android phones come with a PDF viewer built-in, so letting the Android OS decide what application installed on the phone to handle the PDF file should work in most cases.
You could get the pdf file URI and open it with the childBrowser plugin's openExternal and let the native browser handle the PDF.
I have an android application that needs to display the pdf files. For this I am using Adobe PDF reader intent and pass the file path to it.
It works fine when the pdf file is present on the sdcard but I am not able to view the pdf file when it is placed on web (i.e. http://www.myweb.com/pdfs/mypdf1.pdf).
Any idea how to do this?
Adobe Reader on Android does not seem to support this feature so far, as it is really simple.
Maybe you could try Adobe Air, but I am not sure the version on Android supports .pdf.
If not, I suggest you could pass the Intent to the browser, and the browser will download it, and then it can be displayed. Maybe there will be some browser that can open .pdf directly as those do on computer, but I am not aware any.
I have to provide the functionality of showing PDF docs in my app without using any external PDF viewer. I know Android doesn't have such kind of widget and WebView can't load a PDF doc.
So I want to know, is there any widget available which can be used to show the PDF docs in Activity (like WebView is used to show web pages)?
As I know, there is no such 'off-the-shelf' solution available for Android yet. You can of course download any third party PDF viewer's code and modify it as per your needs.
Some of the Open source PDF viewers:
IcePDF
DroidReader
This has already been covered at https://stackoverflow.com/questions/4665957/pdf-parsing-library-for-android
Another solution would be to use a WebView, but then use the pdf.js library to display a given pdf file. I doubt this would look very nice on a small mobile device since it's designed for desktop browsers, but its worth a try.
pdf.js website and demo
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.