将JavaScript生成的SVG转换为文件 [英] Convert JavaScript-generated SVG to a file

查看:180
本文介绍了将JavaScript生成的SVG转换为文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用d3.js来显示一些数据。我想能够获取它生成的SVG代码,并将其存储为 .svg 图像文件(用于在Inkscape / Illustrator中编辑)。



我试过简单地复制svg标签的内容,即

 < svg> 
<! - snip - >
< / svg>

插入到名为image.svg的文件中,但这会漏掉颜色/样式信息,在两个单独的CSS文件中。



我使用这个例子



有一个简单的方法吗?

解决方案

我认为 SVG Crowbar 可能是最好的处理方式。 / p>

文档


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).

I have tried simply copying the contents of the svg tag i.e.

<svg>
<!--snip-->
</svg>

into a file called image.svg, but this misses out on the color/styling information, which is in two separate CSS files.

I'm working with this example.

Is there a simple way to do this?

解决方案

I think SVG Crowbar may be the best way to deal with this.

Documentation

这篇关于将JavaScript生成的SVG转换为文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆