Save jointjs diagram drawn on paper, which can be rendered to paper to edit
Asked Answered
W

1

6

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?

Willingham answered 24/9, 2015 at 12:34 Comment(0)
F
7

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

Fuze answered 25/9, 2015 at 17:17 Comment(1)
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??Willingham

© 2022 - 2024 — McMap. All rights reserved.