Home Forums Chart Support Export function

Export function

Viewing 2 posts - 1 through 2 (of 2 total)
  • #42561

    Hello everyone, I want to know if there is there any way to print a graph together with a table to a pdf file?

    #42580

    @nerviozzo96,

    CanvasJS supports exporting chart as an image or to print it. To export chart rendered within a page along with table, you can use html2canvas & jsPDF as shown in the code-snippet below.

    html2canvas(document.querySelector("#container")).then(canvas => {  
      var dataURL = canvas.toDataURL();
      var pdf = new jsPDF();
      pdf.addImage(dataURL, 'JPEG', 20, 20, 170, 120); //addImage(image, format, x-coordinate, y-coordinate, width, height)
      pdf.save("Chart with Table.pdf");
    });

    Please take a look at this JSFiddle for a working example.


    Vishwas R
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.