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.
Asked
Active
Viewed 1,396 times
1
-
trying using JSPDF, which will handle the rendering of pdf blob or base64 across the browser. – Abhinav Kumar Jan 24 '20 at 07:40
1 Answers
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();