Example #1
0
        //转换文件
        private void ConvertPdfToSWF(string pdfPath, string swfPath)
        {
            string cmdStr = "C:/Program Files/SWFTools/pdf2swf.exe";

            if (!System.IO.File.Exists(cmdStr))
            {
                cmdStr = "C:/Program Files (x86)/SWFTools/pdf2swf.exe";
            }
            if (!System.IO.File.Exists(cmdStr))
            {
                throw new Exception("请安装pdf2swf");
            }

            //创建对应pdf文件和swf文件的保存目录
            System.IO.Directory.CreateDirectory(Path.GetDirectoryName(Server.MapPath(pdfPath)));
            System.IO.Directory.CreateDirectory(Path.GetDirectoryName(Server.MapPath(swfPath)));

            string args   = BuildAgrs(Server.MapPath(pdfPath), Server.MapPath(swfPath));
            string result = CmdHelper.ExecutCmd(cmdStr, args);

            Logger.Log(result);
        }