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

Error: Invalid argument passed to jsPDF.scale Error #251

Closed tqcc closed 1 year ago

tqcc commented 1 year ago

core.mjs:6494 ERROR Error: Uncaught (in promise): Error: Invalid argument passed to jsPDF.scale Error: Invalid argument passed to jsPDF.scale at E.y.scale.y.__private__.scale (jspdf.es.min.js:86:5943) at E.y.__private__.setLineWidth.y.setLineWidth (jspdf.es.min.js:86:45696) at ot (svg2pdf.es.min.js:41:29338) at e.<anonymous> (svg2pdf.es.min.js:41:32521) at svg2pdf.es.min.js:41:1837 at Object.next (svg2pdf.es.min.js:41:1946) at svg2pdf.es.min.js:41:860 at new ZoneAwarePromise (zone.js:1427:1) at c (svg2pdf.es.min.js:41:621) at e.render (svg2pdf.es.min.js:41:32011) at resolvePromise (zone.js:1211:1) at resolvePromise (zone.js:1165:1) at zone.js:1278:1 at _ZoneDelegate.invokeTask (zone.js:406:1) at Object.onInvokeTask (core.mjs:25595:1) at _ZoneDelegate.invokeTask (zone.js:405:1) at Zone.runTask (zone.js:178:1) at drainMicroTaskQueue (zone.js:585:1) at ZoneTask.invokeTask [as invoke] (zone.js:491:1) at invokeTask (zone.js:1648:1)

when I test with a simple svg , it works. but when I use svg2pdf to convert a production svg file, above error occured.

Any peoole saw the same error, is it a bug?

tqcc commented 1 year ago

b

the complicated file failed to convert with above error. the simple triangle file convert normally.

help pls, thank you.

yGuy commented 1 year ago

Thanks for your report. Please strip down the broken SVG file until you can find the parts that make the export fail. With a reduced test-case you will either be able to tell what's wrong with your SVG file or we can use it to improve the library. Please use the playground to create a proper report with a minimal test-case.

yGuy commented 1 year ago

stroke-width="none" looks suspiciously wrong - https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width

tqcc commented 1 year ago

@yGuy Thanks for your reply. the problem is solved after I removed the storke-with stroke-linecap etc.

but min.js.map is not working, I have to customize node_modules to debug. maybe this is just a problem of my environment.