getCircuitAsSVG() API gives undefined
Hi,
I've tried local and falstad website getCircuitAsSVG() API function from javascript but it return "undefined" in the two cases. export to SVG in the menu working (in base64 form) in the two cases.. I don't understand what's the problem.
Any Help :) ?
Sorry, there's an error in the doc. It's asynchronous, because the package that does the SVG conversion may need to be initialized and that is asychronous.
function svgRendered(sim, svg) { console.log('here is svg data:', svg); } sim.onsvgrendered = svgRendered; sim.getCircuitAsSVG();
See here for an example:
https://www.falstad.com/circuit/jsinterface.html
That was a fast reply 🙂 Thanks a lot, it’s working perfectly now! Also, thank you for CircuitJS it’s an amazing tool !