1
votes

1 Answers

0
votes

You can use html2canvas library it will allow you to save any DOM portion as a Canvas:

The script allows you to take "screenshots" of webpages or parts of it, directly on the users browser.

Here's an example of how would be your code:

html2canvas($("#widget"), {
  onrendered: function(canvas) {
    $("#img-out").html("");
    theCanvas = canvas;
    document.body.appendChild(canvas);
    $("#img-out").append(canvas);
  }
});

This is a demo Fiddle.

You can find more examples in html2canvas website.