You must be logged in to post your query.
Home › Forums › Chart Support › jsPDF export renders black charts
Tagged: export black chart background
Using current (v2.2) version of jsPDF with chartJS, the chartJS charts all come up black (backgrounds) in the PDF.
Here is the JSFiddle showing the issue. I have spent 2 days and cannot find a solution. Please help.
https://jsfiddle.net/d72rva36/1
Update: I intended to say canvasJS rather than chartJS above.
@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.
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register