You must be logged in to post your query.
Home › Forums › Chart Support › Export function
Tagged: export, pdf, PNG
Hello everyone, I want to know if there is there any way to print a graph together with a table to a pdf file?
@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
You must be logged in to reply to this topic. Login/Register