用户浏览的时候,客户端直接打开pdf文件,不要弹出下载或保存对话框 目前 就是前台页面一个按钮,点击按钮 直接在客户端打开服务端的文件,不要弹出选择框。可以在浏览器上设置,但不能要求客户也设置吧。求 后台代码或者前台代码。插件也可以 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是客户端浏览器决定的如果本地没安装adobe reader就无法打开PDF,这时候只能下载或保存吧 客户那都安装了 。window.open("");不知道 这个服务端地址怎么写。还要可能组长也不叫这样写。她要求直接打开。 我是13版本的,碰到pdf直接都是打开。然后在上面另存为就可以保存了这个特性也是后来的版本才有的,忘记从哪个版本开始了 是要直接点连接才行,后缀是.pdf 分享一下 就改了几个参数 /** * 用户打开帮助文档 */ public void openHelp() throws Exception{ HttpServletResponse response = Struts2Utils.getResponse(); String fileName = "文档管理系统使用文档.pdf"; //帮助文档路径 String suffix = ZbwtStringUtil.substringAfterLast(fileName, "."); if (suffix != null) { response.setHeader("Content-Type", ZbwtXmlUtil .findContentTypeBySuffix(suffix)); } else { response.setHeader("Content-Type", "application/vnd.ms-pdf"); } InputStream bais = null; OutputStream os = null; bais = new FileInputStream("D:\\encrypt" + "/" + "文档管理系统使用文档.pdf"); os = response.getOutputStream(); byte bytes[] = new byte[1024]; int i = 0; while ((i = bais.read(bytes)) != -1) { os.write(bytes, 0, i); } if (os != null) { os.close(); } if (bais != null) { bais.close(); } }前台提交地址 用 window.open(""); 关于poi读取excel的问题 求高手。。。在线等 AJAX动态结构树 java 在linux下的 问题~谢谢高手~ java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet 初学者的问题 我怎么也找不出原因 List集合排序有没有一种最简单的方法 reports builder做的报表怎么在web里用,能不能用??? 怎么在JbuliderX使用Oracle AS 10g? HTML中的file标签在安卓手机上 CXF 2.4 启动报错
如果本地没安装adobe reader就无法打开PDF,这时候只能下载或保存吧
/**
* 用户打开帮助文档
*/
public void openHelp() throws Exception{
HttpServletResponse response = Struts2Utils.getResponse();
String fileName = "文档管理系统使用文档.pdf"; //帮助文档路径
String suffix = ZbwtStringUtil.substringAfterLast(fileName, ".");
if (suffix != null) {
response.setHeader("Content-Type", ZbwtXmlUtil
.findContentTypeBySuffix(suffix));
} else {
response.setHeader("Content-Type", "application/vnd.ms-pdf");
}
InputStream bais = null;
OutputStream os = null;
bais = new FileInputStream("D:\\encrypt"
+ "/" + "文档管理系统使用文档.pdf");
os = response.getOutputStream();
byte bytes[] = new byte[1024];
int i = 0;
while ((i = bais.read(bytes)) != -1) {
os.write(bytes, 0, i);
}
if (os != null) {
os.close();
}
if (bais != null) {
bais.close();
}
}前台提交地址 用 window.open("");