makeSvg option to not use links?

I haven’t found a way to do this so I suspect the answer is ‘no’ but I’ll ask anyway, in case I am missing something or am being stupid.

I’m making an image of my diagram with diagram.makeSvg and saving that to a .SVG file for display later. The diagram contains Picture elements with .source set to a URL of an SVG file. The result of the makeSvg() call contains those URLs rather than the contents of what they point to.

The problem is that these generated SVG files from makeSvg need to work in an offline environment so the links all show up as broken.

Is there any way to get makeSvg to include the SVG picture contents instead of a link to the picture? The elementFinished argument looks close but I don’t think it will work for this.

Yes, you could provide the elementFinished option to Diagram | GoJS API, which would be a function that replaced the SVG DOM image element’s xlink:href URL with a data URL.

1 Like