Hi, when exporting the diagram as SVG (makeSVG), is it possible to embed nodes images (SVG Picture) instead of using xmlns:xlink?
Right now I’m retrieving those SVG images from a server, and when opening a saved SVG file and the server if offline, the nodes are showing empty. Also in the case of distributing the diagrams to people without access to the server they won’t be able to see it correctly.
Yes, in your call to Diagram.makeSvg you can specify the elementFinished option. If supplied it must be a function taking the GraphObject being rendered and the SVGElement that has been produced so far.
What you can do in that function is modify the SVG element so that it embeds the image instead of referring to a URI.
I got this working for bitmap images and SVGs by embedding as bitmaps, but I’d like to get it working by embedding the SVG vector image. I could try and grab the source file from the image’s src, but since that would be by an async request, the image generation would be long gone by the time it returns. Is the source SVG available somewhere in the go.Picture instance?, I couldn’t find anything in the API reference
That gives me the source URL but not much else. I’m after the XML of the actual SVG, but I guess GoJS may have no need to have access to that so probably won’t expose it