将JavaScript生成的SVG转换为文件 [英] Convert JavaScript-generated SVG to a file
本文介绍了将JavaScript生成的SVG转换为文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用d3.js来显示一些数据。我想能够获取它生成的SVG代码,并将其存储为 .svg
图像文件(用于在Inkscape / Illustrator中编辑)。
I am using d3.js to visualize some data. I would like to be able to take the SVG code that it generates and store it as a .svg
image file (for editing in Inkscape/Illustrator).
我试过简单地复制svg标签的内容,即
I have tried simply copying the contents of the svg tag i.e.
<svg>
<!--snip-->
</svg>
插入到名为image.svg的文件中,但这会漏掉颜色/样式信息,在两个单独的CSS文件中。
into a file called image.svg, but this misses out on the color/styling information, which is in two separate CSS files.
我使用这个例子。
有一个简单的方法来做这个?
Is there a simple way to do this?
推荐答案
我认为 SVG Crowbar 可能是最好的处理方式。
I think SVG Crowbar may be the best way to deal with this.
这篇关于将JavaScript生成的SVG转换为文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文