yWorks / svg2pdf.js

A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts
MIT License
649 stars 98 forks source link

Gradients with same Id's in different containers are rendered in the same color #171

Closed FHoffmannSopra closed 3 years ago

FHoffmannSopra commented 3 years ago

Hey guys,

I rendered two Svg images with the svg2pdf library. Both are rectangles filled with gradients, but in different colors.

On the Pdf both gradients have the same color, dependent on which Svg gets rendered first. The effect is reproducable on any number of Svg's, either they are all blue or all red.

By taking a closer look to the xml representation of the images, I detected that both gradients are using the same Id. As far as I know these Id's should have different scopes so this effect should not appear. Which is the case, when I display both pictures in the browser. After exporting all rectangles are colored blue or red, depending on which one is the first.

I have attached both examples, so you can reproduce the error.

Examples2.zip

I am using the newest versions of both jsPdf and svg2pdf

Thanks for your help Frederic

HackbrettXXX commented 3 years ago

Yes, that's what I just discovered, too :) See my comment in #166.

HackbrettXXX commented 3 years ago

Closing this in favor of #166.