我使用 C#、asp.net 作为工具。
我正在使用以下代码在客户端传输和打开文件,并希望在客户端打开文档的同时打开任何应用程序(如 word、pdf 阅读器)的内置打印对话框。
                if (lfileFormat.ToUpper() == "Excel")
                {
                    Response.ContentType = "application/vnd.ms-excel";
                }
                else if (lfileFormat.ToUpper() == "PDF")
                {
                    Response.ContentType = "application/pdf";
                }
                else if (lfileFormat.ToUpper() == "HTML")
                {
                    Response.ContentType = "text/HTML";
                }
                Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", fi.Name));
                Response.AddHeader("Content-Length", fi.Length.ToString());
                Response.TransmitFile(fi.FullName);
                Response.End();