Friends,
I have a code which open PDF document from base64 data, which work fine for Android 6.0.1 (2016 - Marshmellow) Samsung mobiles, 5.1 (Lolipop) Micromax mobile but not in 5.1.1 Lolipop Samsung device & 7.0 Nougat Lenovo device.
My working code is below:
let downloadPDF: any = ‘W0JFR0lOXQolUERGLTEuMgp6R1/V+d9KpBi3sCNzNh…….’
fetch(‘data:application/pdf;base64,’ + downloadPDF,
{
method: “GET”
}).then(res => res.blob()).then(blob => {
this.file.writeFile(this.file.externalApplicationStorageDirectory, ‘statement.pdf’, blob, { replace: true }).then(res => {
this.fileOpener.open(
res.toInternalURL(),
‘application/pdf’
).then((res) => {
}).catch(err => {
console.log(‘open error’)
});
}).catch(err => {
console.log(‘save error’)
});
}).catch(err => {
console.log(‘error’)
});
Why this happens ? In not working mobiles even that PDF not created . I hope this is a big issue of ionic 3.
Please advise
Thanks
Anes