Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pdf viewer in phonegap Android

I'm looking for a pdf viewer for Android using Phonegap 2.0. I tried the childbrowser plugin which worked on iOS but not on Android. I tried this http://www.giovesoft.com/2011/08/download-and-open-pdf-with-phonegap.html but that didn't work either, I get error messages like PhoneGap is not defined at file and cannot call method "showPdf" of undefined.

like image 666
Leon van der Veen Avatar asked Aug 17 '12 09:08

Leon van der Veen


2 Answers

you can use pdf.js :

pdf.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance.

https://github.com/mozilla/pdf.js

like image 61
Mohammad Razeghi Avatar answered Nov 06 '22 14:11

Mohammad Razeghi


I answered a similar question already (see Open PDF with PhoneGap in Android) but will do the same here. Use the ChildBrowser plugin as suggested in conjunction with Google Docs like so:

onclick='window.plugins.childBrowser.showWebPage(encodeURI("http://docs.google.com/viewer?url=' + pdfLink + '"));

This works fine for me and I have tested it in Android 2.1 up to 4.1.

like image 20
Ian Devlin Avatar answered Nov 06 '22 16:11

Ian Devlin