简体   繁体   中英

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.

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM