svgdojogfx

Save Dojox GFX Canvas as SVG


Is there a way to serialize a Dojox GFX canvas as SVG?

I am looking for a way to save my Dojox GFX canvas contents in a way which can be exported as a graphics file (SVG, PNG, JPG, etc.) which could be easily saved or printed, and SVG seemed the most likely.

I found a reference to a function dojox.gfx.utils.toSvg, which looked perfect:

http://docs.dojocampus.org/dojox/gfx/utils/toSvg

But this function does not exist in my Dojo (1.1) implementation, and is not mentioned in the Dojo Toolkit documentation, so I am not sure if it exists.

Thanks.


Solution

  • It is new in 1.4. Most probably it can be backported to earlier versions, if you have time on hands.

    I didn't understand the part about "[it] is not mentioned in the Dojo Toolkit documentation, so I am not sure if it exists" — you gave the link to the documentation yourself. And I pretty sure you can find examples of its use in /dojox/gfx/tests/