SVG image is cut off when exporting diagram as SVG

When we makeSVG we set the attribute preserveAspectRatio on some images so that they look identical to makeImage, but this presents a problem with images that have SVG sources, since SVG has its own aspect ratio rules. My solution was naive, to simply look at the image source and if it was an SVG file (containing ".svg" in the href) we could decline to set an aspect ratio. This won’t work in your case, since you are using a base64 uri instead of referring to an image.

I could change the code to also detect something like "image/svg+xml" in the href string, and might do that, but that also might be too simplistic to capture all cases. I will consider other possibilities.

In the meantime, if you know what each of your Pictures is doing, you can easily remove the preserveAspectRatio attribute when you make the SVG. So this is an acceptable workaround:

function makeSvg() {
  var svg = myDiagram.makeSvg({
    scale: 1,
    background: "white",
    elementFinished: function(graphObject, SVGElement) {
      if (graphObject instanceof go.Picture) {
        // If you know its an SVG:
        SVGElement.removeAttribute("preserveAspectRatio");
      }
    }
  });
  document.body.appendChild(svg);
}

Of course you may only want to do it on your Pictures that are using SVG.