主题:Asp.net调用FlashPaper的问题,在CMD中可以把DOC转换成SWF
public void ConvertDocToSwf()
{
try
{
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;
p.Start();
string strOutput = null;
string s = @"F:\TDDOWNLOAD\flashpaper\FlashPaper2.2\FlashPrinter.exe " + Server.MapPath("test.doc") + " -o " + Server.MapPath("test.swf");
//s=s.Replace(@"\","\\");
//Response.Write(s);
//Response.End();
p.StandardInput.WriteLine(s);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
this.lblMessage.Text = "success";
}
catch (Exception ex)
{
this.lblMessage.Text = ex.ToString();
}
}
以上是我的代码,点击后提示success成功,但在目录下并没有生成test.swf
而用以下的代码则可以生成,F:\\TDDOWNLOAD\\flashpaper\\FlashPaper2.2目录与E:\\ProgramTest\\Asp目录都已经添加IUser_XXX读写权限,请大家帮忙看下
F:\\TDDOWNLOAD\\flashpaper\\FlashPaper2.2\\FlashPrinter.exe E:\\ProgramTest\\Asp\\test.doc -o E:\\ProgramTest\\Asp\\test.swf
{
try
{
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;
p.Start();
string strOutput = null;
string s = @"F:\TDDOWNLOAD\flashpaper\FlashPaper2.2\FlashPrinter.exe " + Server.MapPath("test.doc") + " -o " + Server.MapPath("test.swf");
//s=s.Replace(@"\","\\");
//Response.Write(s);
//Response.End();
p.StandardInput.WriteLine(s);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
this.lblMessage.Text = "success";
}
catch (Exception ex)
{
this.lblMessage.Text = ex.ToString();
}
}
以上是我的代码,点击后提示success成功,但在目录下并没有生成test.swf
而用以下的代码则可以生成,F:\\TDDOWNLOAD\\flashpaper\\FlashPaper2.2目录与E:\\ProgramTest\\Asp目录都已经添加IUser_XXX读写权限,请大家帮忙看下
F:\\TDDOWNLOAD\\flashpaper\\FlashPaper2.2\\FlashPrinter.exe E:\\ProgramTest\\Asp\\test.doc -o E:\\ProgramTest\\Asp\\test.swf