Export any Chart, any table and any content into Image In Angular2 Project

1.7k Views Asked by At
1

There are 1 best solutions below

0
On

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.