仿百度,豆丁文档在线浏览

将上传的Word, Excel, txt, PPT, Pdf等文档转换成 .SWF格式  如图:

核心代码:

//文件转换

public void ConvertToSWF(string oldFile, string swfFile)
    {
        System.Diagnostics.Process pc = new System.Diagnostics.Process();
        pc.StartInfo.FileName = HttpContext.Current.Server.MapPath("~/FlashPaper2.2/FlashPrinter.exe");//程序路径和名称

        pc.StartInfo.Arguments = string.Format("{0} -o {1}", oldFile, swfFile);
        pc.StartInfo.CreateNoWindow = true;//不创建窗口
        pc.StartInfo.UseShellExecute = false;//不使用系统外壳启动
        pc.StartInfo.RedirectStandardInput = false;//不重定向输入
        pc.StartInfo.RedirectStandardOutput = false;//不重定向输出
        pc.StartInfo.RedirectStandardError = true;
        pc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        try
        {
            pc.Start();
            while (!pc.HasExited)
            {
                continue;
            }
            pc.WaitForExit();
            pc.Close();
            pc.Dispose();
            //System.Threading.Thread.Sleep(4000);
            MessageBox.ShowAndRedirect(this, "转换成功!", "FileInfo.aspx");
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

posted @ 2013-02-04 14:55  完美的爱  阅读(372)  评论(0编辑  收藏  举报