@lottie
To display base64 encoded PDF data in an iframe or embed tag, you can follow these steps:
1 2 3 4 5 6 7 8 |
var base64Data = "your base64 encoded string data"; var byteCharacters = atob(base64Data); var byteNumbers = new Array(byteCharacters.length); for (var i = 0; i < byteCharacters.length; i++) { byteNumbers[i] = byteCharacters.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); var blob = new Blob([byteArray], { type: 'application/pdf' }); |
1
|
var url = URL.createObjectURL(blob); |
1
|
<iframe src="data:application/pdf;base64,{{base64Data}}" style="width:600px; height:400px;"></iframe> |
Replace {{base64Data}}
with the base64 encoded string data.
By following these steps, you should be able to display base64 encoded PDF data in an iframe or embed tag on your website.