Implementing svg export feature of jointjs in angular application

152 views Asked by At

Trying to add svg export feature of jointjs+ in angular application. Ive added some images to the paper but the images are not exported properly in the downloaded svg file. This is my code to implement svg download.

exportAsSVG() { const exportOptions = { padding: 20, useComputedStyles: false, size: "2x" }; format.toSVG( this.paper, (svg) => { util.downloadDataUri( data:image/svg+xml,${encodeURIComponent(svg)}, "jointjs+.svg" ); }, exportOptions ); }

Here is what i get after the svg export. enter image description here

1

There are 1 answers

0
James On

Are you using the convertImagesToDataUris in your options object? Setting to true should convert all contained images. https://resources.jointjs.com/docs/rappid/v3.7/format.SVG.html#format.SVG.configuration

paper.toSVG(function(svgString) {
    console.log(svgString);
}, {
    convertImagesToDataUris: true
});