2015-07-31 18 views
1

Je voudrais convertir .svg graphique vectoriel en .wmf. J'ai regardé dans cette bibliothèque http://wmf.codeplex.com/, mais sans succès.Comment convertir un fichier SVG au format WMF?

J'ai trouvé cette bibliothèque http://svg2swf.sourceforge.net/, mais je ne sais pas comment l'utiliser dans C# projet.

Éditer: Aussi cette utilisation d'inkscape ne fonctionne pas pour moi (le fichier wmf n'a pas pu être ouvert).

public static string Result = @"Polygon-6666.wmf"; 
public static string Source = @"Polygon-6.svg"; 

public void CreatePng(string filename) 
{ 
    var inkscapeArgs = string.Format(@"-f ""{0}"" -e ""{1}""", Source, Result); 

    var inkscape = Process.Start(new ProcessStartInfo("inkscape.exe", inkscapeArgs)); 
} 
+0

Qu'est-ce que vous voulez dire par * pas de succès *? Quels problèmes avez-vous rencontrés? –

+0

Cette bibliothèque que j'ai liée est pour la manipulation de WMF, pas la conversion. Je peux me tromper, parce que la documentation est assez pauvre donc inclus juste pour être sauver. –

Répondre

2

En utilisant la version 0.91 de Inkscape, vous avez des options spécifiques dans la ligne de commande pour le faire:

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); 
} 

fichier d'entrée: https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg

Documentation: inkscape --help

+0

J'essaierai ça lundi, ça va certainement revenir ici avec des commentaires. –

+0

Fondamentalement, vous étiez en train d'ouvrir un fichier avec '-f' et ainsi de suite, la syntaxe que j'ai montré est spécifiquement pour le traitement par lots: D – Aybe