1904labs / dom-to-image-more

Generates an image from a DOM node using HTML5 canvas
Other
508 stars 105 forks source link

Icon to image display failed #149

Open green0701 opened 1 year ago

green0701 commented 1 year ago

@font-face { font-family: "myDocumentEditor"; / Project id 3353833 / src: url('iconfont.woff2?t=1650769832866') format('woff2'), url('iconfont.woff?t=1650769832866') format('woff'), url('iconfont.ttf?t=1650769832866') format('truetype'); }

.dcs-font { font-family: "myDocumentEditor" !important; font-size: 16px; font-style: normal; } .tempICON::before { content: "\e964"; font-family: "myDocumentEditor" !important; } In html:

javascript: domtoimage .toPng(document.getElementsByClassName("tempICON")[0]) .then(function (dataUrl) { var img = new Image(); img.src = dataUrl; document.body.appendChild(img); }) .catch(function (error) { console.error('oops, something went wrong!', error); });

image

AndySpider commented 1 year ago

Same issue here, any solution?