Skip to content

Saving Images #2642

Answered by kumilingus
makleo2002 asked this question in Q&A
Discussion options

You must be logged in to vote

You are looking for format.Raster and format.SVG plugins.

There are several examples of how to export a diagram to an image: https://www.jointjs.com/demos?feature=Export+to+PNG%2FJPEG

And here's a simple example:

import { format, util } from '@joint/plus';

/*... */

format.toSVG(
    paper,
    (svg) => {
        util.downloadDataUri(
            `data:image/svg+xml,${encodeURIComponent(svg)}`,
            'joint-plus.svg'
        );
    },
    { useComputedStyles: false }
);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by makleo2002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants