1

I have generated four charts on the html page using amchart in 4 divs respectively. On each div there is a link for export the chart. The charts are generated using multiple SVG. I want to save the chart separately as an image on client side by clicking the export link.

Finally, I got my solution. I convert all the svg to image one by one and write it in a div using http://www.battlehorse.net/page/topics/charts/save_google_charts_as_image.html

And finally I convert the div content to image using http://html2canvas.hertzen.com/index.html. If any one want to convert the text and svg then you need to clone the div content to the new div and then write the converted image to new div and finally convert it to image.

Aminul Islam
  • 104
  • 2
  • 9
  • possible duplicate of [Convert a div and contents inside it to image](http://stackoverflow.com/questions/10598333/convert-a-div-and-contents-inside-it-to-image) < might be > `:)` i will not down vote you but please improve your question quality consider it a constructive comment bruv!! :)) – Tats_innit Jul 31 '12 at 10:40
  • I try to find the solution but not found that links, any any better solution – Aminul Islam Jul 31 '12 at 10:48
  • have you got any solution on it? and links are not working – Kaval Patel Sep 11 '18 at 06:38

1 Answers1

1

If you could draw the chart on a canvas you could save that. Just saving a div and it's contents to an image is hard (I don't think it's even possible)...

Your question is related to this. It might help.

EDIT

If you are using amchart, it is creating an svg. You can create an hidden canvas, draw the svg onto the canvas, save it as a data url, present it as a jpg/png/.. to the users. (more info)

Community
  • 1
  • 1
VDP
  • 6,340
  • 4
  • 31
  • 53
  • the chart have draw using amchart in a div element. i need to save this as an image – Aminul Islam Jul 31 '12 at 10:51
  • so it's an SVG? you can save that too! http://stackoverflow.com/questions/5433806/convert-embedded-svg-to-png-in-place It's a good idea to update your question, give us more info about this specific problem. – VDP Jul 31 '12 at 10:55
  • Thanks for you suggestion. I'm trying. – Aminul Islam Jul 31 '12 at 11:13
  • 2
    Now, i can convert one svg to image. I follows http://www.battlehorse.net/attach/topics/charts/google_charts_to_image.html, https://gist.github.com/1333906. But i need to convert the div content into image that contains multiple svg. – Aminul Islam Aug 01 '12 at 11:37