Want to save/download Base64 as pdf file using javascript. Below code works in chrome but not in IE. I tried many different ways but not working in internet explorer.
Whats wrong with IE ?
function Base64ToPdf(fileName, base64String) {
const linkSource = "data:application/pdf;base64," + base64String;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
}
// Test
var string = 'Hello World!';
var encodedString = btoa(string);
Base64ToPdf("test.pdf", encodedString);
I have tried with https://stackoverflow.com/a/48796495/2247677 which also not works in IE.