Issue with makeSVG method with embeded svg files

I’m trying to make a svg image from a diagram and I have a problem. I have nodes which have svg pictures. When I’m trying to call a makeSVG method, nodes are generated well, but without these embeded svg elements. I’ve noticed that I get an error:

"Error: <image> attribute width: Expected length, "undefined"."

I’ve checked svg which has been generated by this method and I saw that emebeded svgs exist in the file as an image:

<image x="0" y="0" width="undefined" height="undefined" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...

and as you can see width and height are undefined. I’ve changed these values manually and I was able to see nodes with emebeded svgs. So here is the problem.

My question is. Is it possible, in somehow, to set these values. I’ve tried to assign width/height to the node template:

   name: 'Picture',
   desiredSize: new go.Size(200, 200)


   name: 'Picture,',
   width: 200,
   height: 200

but with no luck. Thanks for any help!

Provide an elementFinished function in the options given to Diagram.makeSvg. Description is under Diagram | GoJS API.

Perfect! This is exactly what I need. Thanks Walter.

What version of GoJS are you using?

We do not set the width and height attributes, but we do set a transform to scale the produced image, so it ought to take up the same amount of space. We’ll consider changing this.

It’s a version 1.7.4. This solution proposed by Walter solved my issue, but for me, it’s a kind of hack. Will be great, when it will happen automatically, based on width/height of the picture. Many thanks.