niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.09k stars 4.75k forks source link

html2canvas is not working fine. it's taking only first screenshot properly and remaining screenshots are coming blank. #3146

Open harshitverma-dev opened 4 months ago

harshitverma-dev commented 4 months ago

async takeScreenshot() { let id = "#LqsAnalyser" + this.asinData html2canvas(document.querySelector(id), { useCORS: true , }).then(function (canvas) { canvas.style.display = "none" document.body.appendChild(canvas); const image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); const a = document.createElement("a"); a.setAttribute("download", "weavr-lqs.png"); a.setAttribute("href", image); a.click(); }); },

   <span class="ml-2" @click="takeScreenshot"><i class="fa fa-download cursor-pointer text-primary bg-black px-2 py-1 border rounded" aria-hidden="true" ></i>
                </span>

html2canvas is not working fine. it's taking only first screenshot properly and remaining screenshots are coming blank. please suggest any solution for this problems.