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
646 stars 96 forks source link

Support for XML #230

Closed Stefanuk12 closed 1 year ago

Stefanuk12 commented 1 year ago

Is your feature request related to a problem? Please describe. Currently, you must use an SVG element to use this package. This means if you are trying to do this with nodejs/on the server, you need to create a "pseudo-element" which I'm not sure would even work.

Describe the solution you'd like The function to support either an element or a string

Describe alternatives you've considered Use a "pseudo-element" for the SVG

yGuy commented 1 year ago

This is not at all feasible with the current implementation as the it requires a working DOM and JavaScript API for the SVG, CSS, and Canvas.

To the best of my knowledge this does not exist for node.js as a pure JS implementation (the stubs that exist in Jest are a joke and don't work at all - about 99.9% of the implementation is missing). Use a headless browser like Puppeteer instead if you want to work with SVG on the server in JavaScript.