Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
您可以调用 inkscape 的命令行版本来执行此操作:
http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx
另外还有一个 C# SVG 渲染引擎,主要设计用于允许 SVG 文件如果这是您的问题,可以在 Codeplex 上的网络上使用,这可能适合您的需求:
原始项目
http://www.codeplex.com/svg
带有修复和更多活动的分叉:(7/2013 添加)
https://github.com/vvvv/SVG
You can call the command-line version of inkscape to do this:
http://harriyott.com/2008/05/converting-svg-images-to-png-in-c.aspx
Also there is a C# SVG rendering engine, primarily designed to allow SVG files to be used on the web on codeplex that might suit your needs if that is your problem:
Original Project
http://www.codeplex.com/svg
Fork with fixes and more activity: (added 7/2013)
https://github.com/vvvv/SVG
使用库 http://svg.codeplex.com/ 有一种更简单的方法(较新版本 @GIT,@NuGet)。 这是我的代码
There is a much easier way using the library http://svg.codeplex.com/ (Newer version @GIT, @NuGet). Here is my code
当我必须在服务器上光栅化 svgs 时,我最终使用 P/Invoke 来调用 librsvg 函数(您可以从 Windows 版本的 GIMP 图像编辑程序获取 dll)。
When I had to rasterize svgs on the server, I ended up using P/Invoke to call librsvg functions (you can get the dlls from a windows version of the GIMP image editing program).
我为此使用 Batik 。 Batik 是一个用 Java 编写的图形库,具有命令行界面。 这使得您可以从 C# 进行蜡染,与 Delphi 中的以下示例相同:
I'm using Batik for this. Batik is a graphics library written in Java, with a command line interface. This makes that you can Batik from C#, same as the following example in Delphi:
要添加@Anish 的响应,如果您在将 SVG 导出到图像时遇到看不到文本的问题,您可以创建一个递归函数来循环 SVGDocument 的子级,尝试将其转换为 SvgText 如果可能(添加您自己的错误检查)并设置字体系列和样式。
如果有疑问请告诉我。
To add to the response from @Anish, if you are having issues with not seeing the text when exporting the SVG to an image, you can create a recursive function to loop through the children of the SVGDocument, try to cast it to a SvgText if possible (add your own error checking) and set the font family and style.
Let me know if there are questions.
您可以为此使用 altsoft xml2pdf lib
you can use altsoft xml2pdf lib for this