Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6968

How to save SVG diagram?

$
0
0

@g.bartoli wrote:

Hi,
I'm trying to export my diagram to SVG format after clicking on a button.

Following your example, I execute the following code in the onclick button callback:

var newWindow = window.open("","newWindow");
if (!newWindow)
{
    window.alert("Unable to export diagram!");
    return;
}
var newDocument = newWindow.document;
var style = {
    document: newDocument,
    background: "white",
    scale: 1
};
var svg = myDiagram.makeSvg(style);
newDocument.body.appendChild(svg);

Everything goes fine, the diagram is correctly converted into SVG in a new browser tab, but I'm unable to save it. "Save as..." for the whole page is not enabled; after right-click on the graph, "Save image as..." is not present; the only thing I can do on the graphics is to select some parts with the mouse like a text editor, but even opening the Inspect tool, just shows the <svg> tag, but I'm still unable to save it.

Do you know how to directly download the raw SVG file to disk?

Many thanks,
Guido

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6968

Trending Articles