Open kruthikaa opened 6 years ago
You can use a style option. See the main page and go to the reference for style. Also see this: https://github.com/tsayen/dom-to-image/issues/21
In short:
domtoimage.toBlob(document.getElementById('yourElement'), {style:{'background-color': 'white'}}).then(function (blob) { saveAs(blob, "your.png"); });
@hjrobinson Thanks for that
Hi, I am using domtoimage to take a screenshot of the page and download as pdf. I'm still new at it. So normally when i try capturing a hidden content using html2canvas, i have an option called onclone. But i don't know what to use for domtoimage.
In my page, there is some data that appears in a dialog box. Following is the code i used to capture the data that is hidden in dialog.
html2canvas(main,{onclone:function(document){ var hiddendiv=document.getElementById('maincomment'); hiddendiv.style.display='block'; }}) .then((canvas) => { const imgData = canvas.toDataURL('image/png'); console.log(imgData); pdf.addImage(imgData, 'JPEG', 0, 0); pdf.save("LapSurvey.pdf"); });
But i want the same result in domtoimage. I tried same onclone in domtoimage. It didn't work.
Can anyone help me with this thing!