user1462231
user1462231

Reputation: 13

Export jqplot chart to PDF

i have a doubt and i can't solve it.

I want to generate a PDF document from the result of some charts created under jqplot plugin.

I know that I can export them to PNG:

 var imgelem = evt.data.chart.jqplotToImageElem();

(this imgelem is a HTMLImageElement object from javascript )

but i have no idea how to encode this image (which is not saved in anywhere) from javascript to get as parameter (or whatever) to JAVA.

I'm using struts and I would like to create a servlet (action) to responde this PDF document.

Thanks in advance. Regards.

Upvotes: 1

Views: 6117

Answers (1)

AbhinavRanjan
AbhinavRanjan

Reputation: 1646

var imgelem = evt.data.chart.jqplotToImageElem();
var imageSrc = imgelem.src; // this stores the base64 image url in imagesrc
open(imageSrc); // this will open the image in another tab

Now you can send this to the server or put it in an html image element. You just need to set "src = imageSrc".

Upvotes: 3

Related Questions