protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["type"])) { swfurl = SiteConfig.SiteOption.UploadDir + "read/swf/" + Request.QueryString["path"]; } else { string path = Server.UrlDecode(Request.QueryString["path"]); string fileMapth = SiteConfig.SiteMapath() + path.Replace(@"/", @"\"); string swffile = Path.ChangeExtension(path, ".swf"); string swfMapath = SiteConfig.SiteMapath() + swffile.Replace(@"/", @"\"); //转换成绝对路径 if (!File.Exists(swfMapath)) { String fs_filename = fileMapth; String fs_convertedfilename = swfMapath; Print2Flash3.Server2 p2fServer = new Print2Flash3.Server2(); p2fServer.ConvertFile(fs_filename, fs_convertedfilename, null, null, null); swfurl = swffile; } else { swfurl = swffile; } } }
public ActionResult OnlineRead() { ////string p = Request.QueryString["FilePath"]; //string p = "demo.doc"; //string filePath = Server.MapPath("~/temp/" + p); //Response.ClearContent(); //Response.ClearHeaders(); //string FilePost = filePath.Substring(filePath.Length - 3).ToLower(); //switch (FilePost) //{ // case "pdf": // Response.ContentType = "application/PDF"; // break; // case "doc": // Response.ContentType = "application/msword"; // break; // default: // Response.Write("<script>alert('该文件格式不能进行在线阅读!'"); // break; //} //Response.WriteFile(filePath); //Response.Flush(); //Response.Close(); ////return View(); string p = "demo.doc"; String fs_filename = Server.MapPath("~/temp/" + p); String fs_convertedfilename = Server.MapPath("~/temp/") + "demo" + ".swf"; Print2Flash3.Server2 p2fServer = new Print2Flash3.Server2(); //p2fServer.DefaultBatchProcessingOptions.BeforePrintingTimeout = 120000;//改成两分钟 //p2fServer.ConvertFile(fs_filename, fs_convertedfilename, null, p2fServer.DefaultBatchProcessingOptions, null);//调用转化主程序 p2fServer.ConvertFile(fs_filename, fs_convertedfilename, null, null, null); //int interfaceOptions = 0; //for (int i = 0; i < cblDocOptions.Items.Count; i++) // if (cblDocOptions.Items[i].Selected) // interfaceOptions |= Int32.Parse(cblDocOptions.Items[i].Value); //Print2Flash3.Server2 p2fServer = new Print2Flash3.Server2(); //p2fServer.DefaultProfile.InterfaceOptions = interfaceOptions; //p2fServer.DefaultProfile.ProtectionOptions = (int)Print2Flash3.PROTECTION_OPTION.PROTENAPI; //p2fServer.ConvertFile(fs_filename, fs_convertedfilename, null, null, null); return View(); }