FLOT data as image for writing to PDF

I use jQuery / FLOT to draw a graph, I would like the user to be able to download a PDF version of the graph. I am writing a PDF using ColdFusion. After creating the graph, I send the html of the div graph through ajax to a CF script that uses cfdocument to write in pdf format. The problem is that in the PDF file, it displays only the axis and marks, and not the actual graph data. Does anyone know how to get a real image that is dynamically created on canvas?

+5
source share
4 answers

I don't think it was implemented in the fleet, but see http://code.google.com/p/flot/issues/detail?id=175

+1
source

, phantomJS ( WebKit).

script, URL- Base64 .

, .

script phantomjs, - base64:

var page = require('webpage').create();
var system = require('system');

var pageUrl = system.args[1];

page.viewportSize = { width: 1280, height: 720 };
page.open(pageUrl , function () {
    console.log(page.renderBase64('PNG'));
    phantom.exit();
});
+3

CutyCapt (http://cutycapt.sourceforge.net/), Flot.

+2

canvas toDataURL() img, PDF- :

var canvas = $("canvas.base")[0];
var tmpimg    = canvas.toDataURL("image/png");
//console.log(tmpimg);
$("body").append('<img src="'+tmpimg+'"/>');

, canvas (.. ) . , - / , .

, , - .

+2

All Articles