Reputation: 313
I'm trying to create a hybrid application using Cordova to download a pdf file and need to read the downloaded file from application.
Now i'm trying to achieve this from cordova-plugin-inappbrowser .
window.open('https://www.google.com/search?q=sample+pdf+download&oq=sample+pdf+download', '_system', 'location=yes');
So with this code line i could download the file and view it internally on the app.
But i need to get the downloaded completed event and downloaded file name. Because i need to read the file internally.( might need a another plugin)
I need to develop a hybrid application. so if there are any other good technologies to achieve this goal i would love to know. (React native ,.. etc )
Thanks in advance.
Upvotes: 1
Views: 652
Reputation: 62
You can use a File Opener Plugin for Cordova like fileOpener2 https://github.com/pwlin/cordova-plugin-file-opener2 in this way you can use the plugin:
cordova.plugins.fileOpener2.open(
'/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf
'application/pdf',
{
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
}
});
Upvotes: 1