Home Forums Chart Support jsPDF export renders black charts Reply To: jsPDF export renders black charts

#37300

@marcmnich,

jsPDF doesn’t support exporting canvas to pdf directly, please refer to this Stackoverflow thread for more information. Instead you can add chart image to PDF using addImage method of jsPDF. Please find the code-snippet below.

var canvas = $("#chartContainer .canvasjs-chart-canvas").get(0);
var dataURL = canvas.toDataURL();

var pdf = new jsPDF();
pdf.addImage(dataURL, 'JPEG', 0, 0);
pdf.save("download.pdf");

Please take a look at this JSFiddle for complete code.
Export chart to PDF using jsPDF


Vishwas R
Team CanvasJS