5

Working on jointjs diagrams on paper. I am able to download the diagram drawn on a paper using following code:

var svgDoc = paper.svg;
var serializer = new XMLSerializer();
var svgString = serializer.serializeToString(svgDoc);

Now I want to save this svg on server, which can be rendered again to paper so that I can edit it and save again.

Is it possible in jointjs?

Zoe
  • 27,060
  • 21
  • 118
  • 148
DEV1205
  • 352
  • 1
  • 6
  • 18

1 Answers1

6

Nope. SVG import is not possible in JointJS. The way you should do it is to export the diagram into JSON and than import it back:

var json = JSON.stringify(graph);
// send the json to the server, store to DB or whatever....

// ... later on...

// load back the json to the diagram:
graph.fromJSON(JSON.parse(json))

See http://jointjs.com/api#joint.dia.Graph:toJSON

dave
  • 4,353
  • 2
  • 29
  • 25
  • while downloading this svg the css class .connection-wrap is not showing effect. The link area is getting filled by black color. Am I missing something?? – DEV1205 Oct 13 '15 at 12:05