svg2pdf.js icon indicating copy to clipboard operation
svg2pdf.js copied to clipboard

Implement vector-effect=non-scaling-stroke

Open dasha-popova opened this issue 7 years ago • 5 comments

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.

dasha-popova avatar Oct 22 '18 08:10 dasha-popova

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?

yGuy avatar Oct 22 '18 09:10 yGuy

Here two examples:

  • latest versions of svg2pdf and jsPdf: https://jsfiddle.net/ladypops/xpvt214o/896964/
  • svg2pdf v1.1.1 and jsPdf 1.3.2: https://jsfiddle.net/ladypops/xpvt214o/896963/

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?

dasha-popova avatar Oct 22 '18 14:10 dasha-popova

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.

yGuy avatar Oct 22 '18 14:10 yGuy

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

dasha-popova avatar Oct 22 '18 16:10 dasha-popova

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.

HackbrettXXX avatar Oct 25 '18 10:10 HackbrettXXX