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
667 stars 104 forks source link

fill-opacity is only applied to one element, subsequent elements ignored #29

Closed TorsteinHonsi closed 7 years ago

TorsteinHonsi commented 7 years ago

Live demo: https://jsfiddle.net/7r9r26vL/4/

yGuy commented 7 years ago

This actually turns out to be a bug in our version of JSPDF: since the graphics state is deemed equal for the subsequent rect, we do not set the opacity state but rely on it still being the active state. However "restoreGraphicsState" does not reset the "activeGState" variable in "resotreGraphicsState" and is called after each primitive. Ideally we would also keep a stack for the graphics states, but as a short-term workaround setting the activeGState variable to null in restoreGraphicsState should fix the issue already.

yGuy commented 7 years ago

Closing as "duplicate" to https://github.com/yWorks/jsPDF/issues/5

yGuy commented 7 years ago

We need to update to 1.2.69 of jspdf for this fix.

Vasilcenko commented 7 years ago

Updated jsPDF to 1.2.69