1

I'm using angular 8 to get the base64 pdf string with iframe to open in new tab but its not opening in internet explorer showing blank page in IE. So i do not want to use iframe to open pdf. Can anybody help me to display base64 pdf string in IE.

1 Answers1

0

Salam mate,

you should first convert the Base64 to blob, you can do it as it shows in this question:

Creating a BLOB from a Base64 string in JavaScript

Then you should use [window.URL.createObjectURL(fileblob)] to convert your blob into URL, after that just create anchor and click it, like follows:

  var fileblob = b64toBlob('<your_base64>', 'application/pdf');
  var url = window.URL.createObjectURL(fileblob); 

  let anchor = document.createElement("a");
  anchor.href = url;
  anchor.target = "_blank"
  anchor.click();