.net 调用 FlashPaper 实现文档转换为SWF

C# code
public static void TransformFile(string filepath)

{
string fppath = System.Configuration.ConfigurationManager.AppSettings["Flashpaper"];
string outpath = filepath.Substring(0, filepath.LastIndexOf('.')) + ".swf";
string param = fppath + " " + filepath + " -o " + outpath;
Process p = new Process();
p.StartInfo.FileName = "C:\\WINDOWS\\system32\\cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
//p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
try
{
p.Start();
string strOutput = null;
p.StandardInput.WriteLine(param);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
}
catch (Exception ex)
{
throw ex;
}
}

 

注意:如果不能正常操作,是权限的问题,以iis 为例,请把IUSR_xxx授权到读写的文件夹。


posted @ 2010-10-22 15:19  影子科技  阅读(2634)  评论(1编辑  收藏  举报