I am using jQuery/FLOT to draw a graph, I would like for the user to be able to download a PDF version of the graph. I am writing the PDF using ColdFusion. After creating th
You could also take a snapshot of your canvas using toDataURL() and substitute in an img element, which the PDF converter should be able to handle:
var canvas = $("canvas.base")[0];
var tmpimg = canvas.toDataURL("image/png");
//console.log(tmpimg);
$("body").append('
');
Note that the image produced is just the canvas contents (ie, the graph itself) and does not include the axes or legend. You might have to do some tricky substitution/alignment of the image in the flot placeholder, but it gets you a usable image to start from.
This is just a slight re-working of the accepted answer to this question and I thought somebody here might find it useful.