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
654 stars 101 forks source link

fill gradient rect not working #77

Closed dippindots closed 5 years ago

dippindots commented 5 years ago

Describe the bug We rendered the gradient rect but when we download it, it turns to a single color.

To Reproduce https://jsfiddle.net/zgfilx/6zh05e4k/

Expected behavior we can download the gradient rect correctly.

Desktop (please complete the following information):

Additional context If this is not a bug, could you tell me where I am wrong? Thanks!

HackbrettXXX commented 5 years ago

The reason is that you use percentage values for the stop offsets. This is currently not supported by svg2pdf. As a workaround you can use values between 0 and 1.

dippindots commented 5 years ago

@HackbrettXXX Thank you so much, that works perfectly. Do you have a plan to support the percentage? I may help to make a pr.

HackbrettXXX commented 5 years ago

Feel free to provide a pull request. Should be quite easy to implement that. Search for "offset" in the code ;)