I'm creating a hybrid app in android which need to open the pdf files manually stored locally. How to make android open that file without net, it should be opem within the app without using any other software? thank you
Asked
Active
Viewed 112 times
1 Answers
0
Android does not provide a built-in PDF reader like iOS does, so you are limited in your options:
Here are some suggestions:
View the file using Google Docs by storing the file at a remote server and redirecting the user like so:
window.open(encodeURI('https://docs.google.com/gview?embedded=true&url=http://www.your-server.com/files/your_file.pdf'), '_blank', 'location=yes,EnableViewPortScale=yes');
Or use a Cordova plug-in. For example this one (you can search in Google for more). For this, you'll need to learn how to create Cordova plug-ins in Worklight.
You can read more options here: Phonegap InAppBrowser display pdf 2.7.0
-
Note that the first solution is very limited. The UI is very old and after a few times it will block you... – Stephane Mathis Oct 12 '15 at 07:05
-
so if want to open it locally without the internet, it is possible, by installing a cordova plugins in worklight? – C.Laetitia Oct 12 '15 at 07:17
-
You might want to use pdf.js library – Giri Oct 12 '15 at 08:17
-
yes Giri. Does we have it? – C.Laetitia Oct 14 '15 at 02:19