I am trying to convert a dom element to Blob, which I want to use later for sending the same as attachment(as pdf). The code for the same is as following:
Dom element:
<div id="dom-container">
Dom container
</div>
Code for dom to blob conversion: (in order to check the conversion, I am downloading as PDF)
const blobData = new Blob([document.getElementById('dom-container')], {type: "text/html"});
const a = document.createElement("a");
const object_URL = URL.createObjectURL(blobData);
a.href = object_URL;
a.download = 'file.pdf';
a.click();
URL.revokeObjectURL(object_URL);
After opening the file.pdf, getting the below error:
Can someone please help me to figure out where is the issue while this dom to blob/pdf conversion.
Thanks in advance.