yWorks/svg2pdf.js

Support for letter-spacing Attribute in <text> Element

junboxiao opened this issue · 4 comments

Description:

I have encountered an issue where svg2pdf.js does not support the letter-spacing attribute in SVG elements. This attribute is crucial for proper text rendering in my project.

Steps to Reproduce:

Create an SVG with a element that includes the letter-spacing attribute.
Convert the SVG to PDF using svg2pdf.js.
Observe that the letter-spacing attribute is not applied in the PDF output.
Expected Behavior:
The letter-spacing attribute should be supported and correctly applied to text elements in the converted PDF.

Actual Behavior:
The letter-spacing attribute is ignored, and the text appears without the specified spacing in the PDF.

Example:

<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
  <text x="10" y="20" letter-spacing="10px" font-family="Arial" font-size="20">Example Text</text>
</svg>

When converted to PDF, the letter-spacing is not reflected.

Environment:

svg2pdf.js version: ^2.2.3
Browser: Chrome
Operating System: MacOS
Thank you for your attention to this matter. Implementing support for the letter-spacing attribute would greatly improve text rendering capabilities in svg2pdf.js.

yGuy commented

Is there support for this on the level of js2pdf ? If not, I guess it would need to be added there, first, so we can use the feature, here.

Thank you for your response.

The letter-spacing attribute is indeed supported by jsPDF. Therefore, it should be feasible to implement this feature in svg2pdf.js using the existing capabilities of jsPDF.

If you need any further information or assistance in implementing this feature, please let me know. I am looking forward to seeing this enhancement in svg2pdf.js.

Thank you for your attention to this matter.

yGuy commented

Great, thanks.

We'll be accepting PRs for this feature.

Great, thank you very much!