How to open local File on the device (PDF...)
Just checked this... the changes will be compiled. Sorry about the misinformation at first.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Just checked this... the changes will be compiled. Sorry about the misinformation at first.
Thanks Max.
I changed the android code to be compatible with the 2.0 version of Appery:
// start - load local file
String urlFile = args.getString(0);
if (urlFile.startsWith("file:")){
try{
this.openLocalFile(args.getString(0));
} catch (JSONException e) {
status = PluginResult.Status.JSON_EXCEPTION;
browserCallbackContext.error(result);
} catch (IOException e) {
status = PluginResult.Status.IO_EXCEPTION;
browserCallbackContext.error(result);
}
browserCallbackContext.sendPluginResult(new PluginResult(status, result));
}
// end - load local file
Hello Sjef,
thanks for sharing.
It seems a brilliant idea to change the childbrowser behaviour to open files with native code, thanks for sharing.
I'm trying to implement the code for Android but I'm having troubles.
I make the changes inside ChildBrowser.java; when I call the child browser inside my javascript with window.plugins.childBrowser.showWebPage("file:///mnt/myBill.pdf");
I get this error:
processMessage failed: Error: TypeError: Cannot read property 'childBrowser' of undefined
If I try to avoid window.plugins and call directly window.open it seems the program doesn't enter into childbrowser.java code.
I read that now Cordova implement inAppBrowser directly in core and I believe that window.open call exactly that code now and not the childBrowser.java one.
Is it that true? Is there a way for reach the same result of this brilliant forum post but with the core inAppBrowser or with other ways?
Thanks in advance for any reply,
Marco
Marco,
"Cordova implement inAppBrowser directly in core and I believe that window.open exactly call that code" - Yes, it's true. You may find more information here: http://cordova.apache.org/docs/en/3.3...
But nothing prevents you to connect the plugin childBrowser and use it. http://devcenter.appery.io/documentat...
Ok so i need to do this now, and this thread is 1 year old, and it would seem out of date.
Could i please have some CURRENT instruction on how to open a pdf file from the local file system.
I want to be able to:
1) open it locally
2) save it to a database (apperyio database)
3) have server code send it via SMTP to a email recipient.
incidentally the pdf file is being generated using jspdf.
Anyone?
Hello David,
1) did you use window.open? (https://getsatisfaction.com/apperyio/...)
2) You can upload files as shown here: https://devcenter.appery.io/documenta...
3) You can use any service for that, e.g. sendgrid: https://devcenter.appery.io/documenta...