Closed rkbbd closed 2 years ago
async htmlTextToCanvas(htmlText) {
const iframe = document.createElement('iframe');
iframe.style.width = '0px'
iframe.style.overflow = 'hidden'
document.body.appendChild(iframe)
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(htmlText)
iframe.contentWindow.document.close()
const dom = iframe.contentWindow.document.body
//const dom = new DOMParser().parseFromString(`<div>111</div>`, "text/xml").firstChild
const canvas = await html2canvas(dom).finally(() => {
iframe.parentNode.removeChild(iframe)
})
return canvas
}
Bug reports:
Taking a screenshot using Virtual DOM does not work. Error:
Code:
Specifications: