Can anybody tell me what I'm doing wrong here? The svg file is created but the output is not. I do not get any errors until I try and find the output file.
// Set the temporary file names.
string svgFileName = GetTempFileName() + ".svg";
string outputFile = GetTempFileName() + "." + fileType;
// Write the svg data to the temp file.
System.IO.File.WriteAllText(svgFileName, System.Web.HttpUtility.UrlDecode(svgData));
// Use inkscape to convert the svg data to the desired type.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = WebHelper.GetAppSettingAsString("InkscapeFilePath");
p.StartInfo.Arguments = String.Format("--file \"{0}\" --export-{1} \"{2}\" ", svgFileName, fileType, outputFile);
p.StartInfo.UseShellExecute = true;
p.Start();
p.WaitForExit();
Inkscape not creating output file. C#
Re: Inkscape not creating output file. C#
Are you talking about using the command line? I think that's a known issue. See this FAQ item: https://inkscape.org/en/learn/faq/#Open ... %20Windows
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Inkscape not creating output file. C#
Does WebHelper.GetAppSettingAsString("InkscapeFilePath") return what is expected ? (Path + exe name)
Maybe System.IO.File.WriteAllText returns before the file has been really written ? (So it is not found when you launch inkscape)
Maybe Arguments need to start with a " " ?
Launch your debugger to see what command is fired and make sure it works if you paste it into a dos box
Maybe System.IO.File.WriteAllText returns before the file has been really written ? (So it is not found when you launch inkscape)
Maybe Arguments need to start with a " " ?
Launch your debugger to see what command is fired and make sure it works if you paste it into a dos box
-
- Posts: 2
- Joined: Fri Nov 07, 2014 6:33 am
Re: Inkscape not creating output file. C#
As always it's the simplest things that get you. the string fileType was being passed in as all caps. Since I am using that variable as part of the command line call it needs to be sent as lower case. Only 6 hours of troubleshooting! Thanks for all your help.