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 100 forks source link

Nested <tspan /> elements #123

Closed giacomarco closed 3 years ago

giacomarco commented 4 years ago

With this svg code `

lorem i p su m

` i had not text if i remove all nested tspan i had the correct pdf.

Thanks for any help.

yGuy commented 4 years ago

I believe nested tspan's simply aren't considered at all, at the moment. Thanks for reporting. This should not be too difficult to fix, but needs some additional state-keeping.

giacomarco commented 4 years ago

if I comment line 3813 if (tSpan.childElementCount > 0) { // filter <title> elements... // textContent = ""; <---- this line for (var j = 0; j < tSpan.childNodes.length; j++) { if (tSpan.childNodes[j].nodeName === "#text") { textContent += tSpan.childNodes[j].textContent; } } } i have back the text in svg but without any style, no bold no italic etc.. if i found other informations i'm happy to help.

giacomarco commented 4 years ago

@yGuy Do you have some news about this fix? I can do something for help you ?

yGuy commented 4 years ago

If I had news, I would post them, here. This is an open-source project and everybody is free to collaborate. Of course, in reality, no one does, except for the project owners (us). That's how most OSS projects "work". Sorry for not working full-time on this project over the holidays.

giacomarco commented 4 years ago

Thank you so much for your work and i'll do my best for help in this project. It's obviously that you don't work during holidays; holidays are made for refill "batteries"

HackbrettXXX commented 3 years ago

Fixed in #161.