Closed Fufs closed 1 year ago
That's because you are passing the number as a string (.toFixed()
returns a string) - pass it as a Number and it should work. The API will not automatically try to parse and convert strings into numbers. Ideally it would provide a clear error message. But typescript should have also warned you about this mistake.
Yup, that was exactly the issue. I haven't even realized that .toFixed()
returns a string. Just parsing it as a float works beautifully, thanks!
Describe the bug When adding the svg to the doc with width and height options (might also affect x and y) being a float, I get an error
t.toFixed is not a function
. Works fine with ints or no options set.What version are you using (exact version of svg2pdf.js and jspdf)?
To Reproduce Code:
SVG I was testing with:
Log:
Expected behavior No error thrown.
Desktop (please complete the following information):