Hi,
I have a issue this is my function for download and open the pdf file in mobile app
letProcessReportCard(Url) {
var currentDate = new Date();
var currentTimeStamp = currentDate.getTime()
let path = this.file.dataDirectory;
const transfer = this.transfer.create();
transfer.download(Url, path + ${currentTimeStamp}.pdf
).then(entry => {
this.hideLoader();
let url = entry.toURL();
console.log(‘the url is as’, url);
if (this.platform.is(‘ios’)) {
this.document.viewDocument(url, ‘application/pdf’, {});
}
else {
this.fileOpener.open(url, ‘application/pdf’)
.then(() =>
console.log(‘File is opened’))
.catch(e => console.log(‘Error opening file’, e));
}
});
}
in this code when i click on submit button loader is start until the file downloaded from the server and hide loader after download then open file using file opener workd perfectly but if i click on submit button loader starts and if i click on back button loader stop but the file still open after few seconds. I want to stop to open the file if user click backbutton between downloading the file. please help