Page 2 of 2

How to open local File on the device (PDF...)

Posted: Wed Sep 11, 2013 9:43 pm
by maxkatz

Just checked this... the changes will be compiled. Sorry about the misinformation at first.


How to open local File on the device (PDF...)

Posted: Wed Sep 11, 2013 11:34 pm
by Deodorant King

Thanks Max.


How to open local File on the device (PDF...)

Posted: Tue May 20, 2014 8:42 am
by Sjef Moling

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


How to open local File on the device (PDF...)

Posted: Tue May 20, 2014 9:01 am
by Evgene Karachevtsev

Hello Sjef,

thanks for sharing.


How to open local File on the device (PDF...)

Posted: Wed Jul 09, 2014 2:19 pm
by Marco Brenna

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


How to open local File on the device (PDF...)

Posted: Thu Jul 10, 2014 8:31 pm
by Evgene Karachevtsev

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...


How to open local File on the device (PDF...)

Posted: Thu Aug 06, 2015 4:25 am
by David Kleinschmidt

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?


How to open local File on the device (PDF...)

Posted: Fri Aug 07, 2015 4:52 pm
by Serhii Kulibaba

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...