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
649 stars 98 forks source link

<use> does not clip text tags correctly #174

Open Qendolin opened 3 years ago

Qendolin commented 3 years ago

Describe the bug <text> tags referenced by <use> aren't clipped correctly.
The text exists in the pdf (can be selected) but is partially or completely invisible.

Versions: jsPDF: 2.3.1 svg2pdf.js: 2.1.0

To Reproduce Reference a <text> tag in a <use> tag.

See playground

Expected behavior The complete text referenced by the <use> tags should be visible in the pdf.

Screenshots SVG and PDF

Desktop

HackbrettXXX commented 3 years ago

Thanks for reporting this bug. Seems like the bounding boxes aren't correct for text elements. This looks very suspicious ;): https://github.com/yWorks/svg2pdf.js/blob/90f6b853692844bea93ebf0415dc566f327cf958/src/nodes/text.ts#L230-L232