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

Markers ignore a stroke-width attribute of a path #12

Closed mwasiluk closed 7 years ago

mwasiluk commented 7 years ago

Hi, there is a problem with rendering markers on paths with a stroke-width attribute. An example from the slightly changed tests/test12.html:

Svg : svg

Rendered pdf : pdf

yGuy commented 7 years ago

OK - thanks for reporting - any idea in what way it is broken?

yGuy commented 7 years ago

From the spec:

‘markerWidth’, ‘markerHeight’ and the contents of the ‘marker’ represent values in a coordinate system which has a single unit equal the size in user units of the current stroke width (see the ‘stroke-width’ property) in place for the graphic object referencing the marker (https://www.w3.org/TR/svg-markers/)

Basically this means: scale the markers by the stroke-width