In MxGraph when export the diagram we are passing the XML value to server side and convert into image. Is there any option in Javascript (client side) to export the diagram, means convert the Graph xml to jpeg or png image using front end (Javasript) only.
Asked
Active
Viewed 2,101 times
1 Answers
0
As you know, mxgraph is rendered as a svg. You can either either us this svg directly or use any library to convert this to png. In react, I have used 'save-svg-as-png' library to convert svg to png

ksholla20
- 168
- 1
- 1
- 8
-
I am not getting you. We have a mxgraph xml only. We are not using react. We are using Javascript mxgraph only. – user1996037 Nov 07 '17 at 06:55
-
During graph init, you would have given a div container All your graph elements will be rendered in this div as svg This svg will be a child node of the div. You can either directly export this svg, or convert to png/jpeg (https://stackoverflow.com/questions/3975499/convert-svg-to-image-jpeg-png-etc-in-the-browser) – ksholla20 Nov 08 '17 at 23:09
-
1We have graph elements is in xml format. Then how we render as a svg. We need to convert xml to svg? Please clarify – user1996037 Nov 14 '17 at 18:43
-
This does not answer the question and makes a blind assumption that the OP is using React. – Victor Dec 21 '18 at 10:18