I am trying to save entire flot (Pie/Bar)Chart to PDF. I am using jQuery/FLOT to draw a Pie and Bar Chart.
I have the code for downloading the flot chart as PDF but I have three charts in one page and the problem is once I click download they printed in the page and in the same time I got them in different PDF separately. My question is it possible to have them all in one pdf and without printing them in the page.
Any idea ?
Thank you.
Here is my code:
<div id="container" style="width:330px;height:330px"></div>
<a id="toPdf">Download as PDF </a>
var _canvas = null;
$(function() {
$.plot($("#container"), [ { label: 'Test', data: [[0, 0], [1, 9]] } ], { yaxis: { max: 1 } });
$("#toPdf").on("click", function(e) {
e.preventDefault();
html2canvas($("#container").get(0), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
var imgData = canvas.toDataURL('image/png');
console.log('Report Image URL: '+imgData);
var doc = new jsPDF('landscape');
doc.addImage(imgData, 'PNG', 10, 10, 190, 95);
doc.save('testingPDF.pdf');
}
});
});
});