@anespa ur code looks perfect. but the problem here is converstion of base64 to blob.
let blobPdf = this.b64toBlob(base64pdf, ‘application/pdf’,512);
Use FetchAPI to convert the base64 to blob response. I hope this will solve ur problem.
let base64pdf = downloadPDF
fetch('data:application/pdf;base64,' + base64pdf,{
method: "GET"
}).then(res => res.blob()).then(blobPdf => {
this.file.writeFile(this.file.externalRootDirectory, 'Ownership.pdf', blobPdf, { replace: true })
.then(res => {
console.log('wres', res);
this.fileOpener.open(res.toInternalURL(), 'application/pdf').then((ores) => {
console.log('ores', ores)
}).catch(err => {
console.log('open error');
});
}).catch(err => {
console.log(‘error’)
})