C# 如何将SVG文件转换为WMF格式?
我想将.svg矢量图形转换为.wmf。我查看了这个图书馆,但没有成功 我找到了这个库,但我不知道如何在c#project中使用它 编辑:同样,inkscape的这种用法对我不起作用(wmf文件无法打开) 使用的0.91版,您可以在命令行中使用特定选项:C# 如何将SVG文件转换为WMF格式?,c#,svg,file-conversion,wmf,C#,Svg,File Conversion,Wmf,我想将.svg矢量图形转换为.wmf。我查看了这个图书馆,但没有成功 我找到了这个库,但我不知道如何在c#project中使用它 编辑:同样,inkscape的这种用法对我不起作用(wmf文件无法打开) 使用的0.91版,您可以在命令行中使用特定选项: private void Demo() { var inkscapePath = @"C:\Program Files\Inkscape\inkscape.exe"; var inputPath = @"D:\Downloads\
private void Demo()
{
var inkscapePath = @"C:\Program Files\Inkscape\inkscape.exe";
var inputPath = @"D:\Downloads\Ghostscript_Tiger.svg";
var outputPath = @"D:\Downloads\Ghostscript_Tiger.wmf";
Svg2Wmf(inkscapePath, inputPath, outputPath);
}
private void Svg2Wmf(string inkscapePath, string inputPath, string outputPath)
{
if (inkscapePath == null) throw new ArgumentNullException("inkscapePath");
if (inputPath == null) throw new ArgumentNullException("inputPath");
if (outputPath == null) throw new ArgumentNullException("outputPath");
var arguments = string.Format("--export-wmf=\"{0}\" \"{1}\"", outputPath.Trim('"'), inputPath.Trim('"'));
Process.Start(inkscapePath, arguments);
}
输入文件:
文档:
inkscape--help
你说不成功是什么意思?您遇到了什么问题?我链接的这个库用于wmf操作,而不是转换。我可能错了,因为文档很差,所以只为了保存而包含它。我会在周一尝试,肯定会带着反馈返回这里。基本上你是用-f
等打开一个文件的,我展示的语法是专门用于批处理的:DGood ol'Inkscape。
private void Demo()
{
var inkscapePath = @"C:\Program Files\Inkscape\inkscape.exe";
var inputPath = @"D:\Downloads\Ghostscript_Tiger.svg";
var outputPath = @"D:\Downloads\Ghostscript_Tiger.wmf";
Svg2Wmf(inkscapePath, inputPath, outputPath);
}
private void Svg2Wmf(string inkscapePath, string inputPath, string outputPath)
{
if (inkscapePath == null) throw new ArgumentNullException("inkscapePath");
if (inputPath == null) throw new ArgumentNullException("inputPath");
if (outputPath == null) throw new ArgumentNullException("outputPath");
var arguments = string.Format("--export-wmf=\"{0}\" \"{1}\"", outputPath.Trim('"'), inputPath.Trim('"'));
Process.Start(inkscapePath, arguments);
}