I know that pdfs, in general, just work on both android and ios, but i was specifically curious about how you would use pdfs within a cordova. Example file download and open in cordova inappbrowser. How to save a pdf from a base64 string on the device with. I had the same problem as the op and many unsuccessful approaches later i came to the following solution tested with cordova 3. Contribute to pwlincordova plugin file opener2 development by creating an account on github. Follow platform specific guides to install additional platform dependencies. Phonegap how to download and open pdf file in android app stack. Then we zip it, run through phonegap and then download and open. The cordova plugin file plugin gives us access to the userss file system, and the cordova plugin file opener2 plugin helps us with. This is a newish html5 feature that tells the browser that it should download the asset instead of trying to. Thanks for contributing an answer to stack overflow. Pdf document viewer cordova plugin for ios, android and windows 8.
I can download the file successfully, and place it in. Contribute to pwlincordova pluginfileopener2 development by creating an account on github. It also lets the user open the files in a webview and polyfills the anchors download attribute. Devrel at large, star wars nerd, webserverless hacker, lover of good beer and good books. How to properly download and show a frickin pdf in cordova. Example file download and open in cordova inappbrowser example download andopen. This plugin offers a slim api to view pdf files which are either stored in the apps assets folder or in any other file system directory available via the cordova file plugin e. Previous post how to download and open a pdf on phonegapcordova. Download them to a temp folder before starting the viewer. In this example, we will show you how to create file, write to file, read it and delete it. Because of how cordova works we need the cordova plugin file, the cordova plugin file opener2 and file saver. Follow the link below, download the cordova plugin of the pdf reader for free.
Do download the file and use the fileopener plugin for android phonegap apps as explained in this stackoverflow answer. Downloading and opening a pdf in phonegap on an android unit seems to be opone of the hardest things you can nowadays, that and maybe copy files to my samsung galaxy tab 10. The base64 string will be processed and converted into a writable blob. We need to run the following code in the command prompt to install this plugin. This will either open the file in the installed pdf reader or present the user with a. The cordova file writer provided by the cordova file plugin doesnt support write files with base64, therefore we are going to use a little trick. Open a command prompt or terminal, and type npm install g cordova. Apparently downloading and opening a pdf in phonegap cordova seems to be one of the hardest things to, but not anymore.
I want to open pdf file from url within app screen without open any inappbrowser or external app please tell me is there is any solution for this. This plugin offers a slim api to view pdf files which are either stored in the apps assets folder. This plugin tries to open a file in a local viewer. Apparently downloading and opening a pdf in phonegapcordova seems to be one of the hardest things to, but not anymore.