I have a Website(ReactJs) with a pdf download functionality(via base64) and it works fine. For Android, I have a cordova app where the app is pointed to website and no actual app code resides inside cordova and this is where the problem starts.
The PDF download is not working in app and I have been restricted from using native java code or Cordova(js + file-plugin).
Is there any way to achieve this with given constraints?
Related
I am currently developing a mobile project using Cordova and Ionic2 using an external database resource that connects to the mobile via REST webServices.
The database has documents pdf saved that you have to send to the mobile and view the same. I am using the pdf in enconding Base64 through the webservices by Json.
I can get the string in base64, but I do not quite understand how to decode it and save it on mobile, which is Android to be able to see it.
Use the native File component from Ionic 2.
ionic cordova plugin add cordova-plugin-file
npm install --save #ionic-native/file
To save the base64 string on the device you call the createFile(path, fileName, replace) method.
More info: Ionic 2 File
I had a similar battle with PDF's, but dealing with them in binary/Blob form. Similar problem/solution overall. It seems that PDF opening isn't as simple as it should be across Web/Android/iOS.
Open createObjectURL Blob on Cordova InAppBrowser
web-crawler written in python3, webdriver.Firefox() or webdriver.Chrome(Path) allows to open the browser and extract something. But, what if this crawler (written in python) exported to Android either using Kivy or using some other way Will .apk file work? Will the browser will open there too? In .apk file, we cannot not allow to open the browser. Then how the web-crawler will work? Any other solution except headless browsing that can work in android application ?
I have a working web application. How would I refer to the index.html to this app's index.html?
super.loadUrl(“file:///android_asset/www/index.html”);
My web app already have the index.html. Do I just refer to that URL? Say my app is at:
www.myapp.com
Do I just type that address?
To quickly get it up and running put your index.html and any other html/images/css/javascript into zip file and upload to the PhoneGap build site. There's more to it that that but for a simple static app that will work.
I am developing an web+cross platform app using Jquery Mobile+PhoneGap+Android. In web app, I am able to open pdf file links within my app page using iframe. But, in Phonegap generated Android build, iframe is unable to render pdf content,it is showing that iframe area as empty.How can I display the pdf file/content, whose src I know at runtime, within android webview. Thanks In Advance.
I've just published my plugin, which can open almost any type of file, which is stored locally on Android device.
Please take a look at: https://github.com/markeeftb/FileOpener
Plugin opens external application which handles the preview of the document.
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.