Taking a Screenshot of Webpage

Viewed 28

I would like to take screenshot of webpages and let the users download as PNG files. my code is working fine, but it is not capturing some image elements.

What am I doing wrong.

Here is the code

<!-- https://github.com/niklasvh/html2canvas -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.4/html2canvas.min.js"></script>
<script>
function capture () {
  html2canvas(document.body).then((canvas) => {
    let a = document.createElement("a");
    a.download = "ss.png";
    a.href = canvas.toDataURL("image/png");
    a.click();
  });
}
</script>
<input type="button" value="Capture" onclick="capture()"/>

And the results from this code is this capture enter image description here

But my website looks kind of like this, clearly you can see what is missing

enter image description here

0 Answers
Related