I get a base64 file(pdf) from server,which I have to open in new tab and download it,and when download is over I have to close that tab,in angular.I used this but its not working
this.http.get(`url`)
.subscribe((response: any) => {
const filePath = 'data:application/pdf;base64,' + response.data;
const aTag: any = document.createElement('a');
const fileName = response.name;
aTag.href = filePath;
aTag.download = fileName;
document.body.appendChild(aTag);
window.open(filePath, '_blank');
aTag.click();
document.body.removeChild(aTag);
window.close();
}, (error) => {
this.notificationMsgService.errorHandler(error);
})