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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With