Closed edemaine closed 6 months ago
Thank you for the bug report. I could reproduce it.
I assume the issue is that the bounding box calculated for the use is infinite for the empty path, which it shouldn't. To fix it, I think we need to extend this if to also check for empty paths, like already done in renderCore
:
Could you prepare a PR? I will happily merge it.
Describe the bug It seems that a
<path>
with nod
argument, inside a<defs>
, crashes when<use>
d.What version are you using (exact version of svg2pdf.js and jspdf)?
To Reproduce Minimal SVG input:
Playground link
Expected behavior I would have expected a blank PDF. Chrome has no issues rendering this.
Actual behavior Exception:
Error in function M.y.hpf.y.__private__.hpf (https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js:86:5369): Invalid argument passed to jsPDF.hpf
Desktop (please complete the following information):
Additional context This SVG is admittedly a little silly, but it's automatically generated from MathJax's SVG output. I could filter out dummy symbols like this, but it would be nicer if jspdf didn't crash in this case.