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

Implement vector-effect=non-scaling-stroke #57

Open dasha-popova opened 6 years ago

dasha-popova commented 6 years ago

Attribute vector-effect="non-scaling-stroke" for path, rect, line and others stops working. No matter it's jsPdf v1.3.2 with svg2pdf 1.2.1 or jsPdf v2.0.0 with the latest version of svg2pdf. In 1.1.1 it worked correctly.

yGuy commented 6 years ago

I don't see we ever had support for this SVG feature in svg2pdf - can you provide sample input and output to prove your point?

dasha-popova commented 6 years ago

Here two examples:

In console you can open the link and see the difference.

I've tried a lot of combinations of different versions and it works only with 1.1.1. Any ideas?

yGuy commented 6 years ago

Thanks for the example. That's actually a coincidence: Up to 1.1.1 we obviously did not scale the strokes at all. If you remove the vector-effect in the 1.1.1 example you get the very same results and the lines do not get scaled (although they should). In a way this was a bug and you benefitted from it. The resolution to your problem would be the implementation of the feature, rather than fixing a non-existant feature.

dasha-popova commented 6 years ago

Oh, thanks :) So will this feature be implemented in the nearest future? Or where can I control(or remove) stroke scaling?

HackbrettXXX commented 6 years ago

Since we do not need to implement the whole vector effects API for the "non-scaling-stroke" vector effect, this can be implemented quite easily. We might consider it for the next release.