IE显示pdf文件出现一把叉叉
想把pdf显示在IE中, 用得的 html中的 OBJECT
<OBJECT height="100%" width="100%" border="0" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000">
<PARAM NAME="_Version" VALUE="65539"/>
<PARAM NAME="_ExtentX" VALUE="600"/>
<PARAM NAME="_ExtentY" VALUE="500"/>
<PARAM NAME="_StockProps" VALUE="0"/>
<PARAM NAME="SRC" VALUE="<s:text name='%{fileAppSrc}'/>" />
</OBJECT>
改了好多次了都还是一把叉叉,把路径写从绝对路径也出错了,求大虾们帮帮忙!
在线等~!~!
[解决办法]
路径不对
[解决办法]
- HTML code
<OBJECT height="100%" width="100%" border="0" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"> <PARAM NAME="_Version" VALUE="65539"/> <PARAM NAME="_ExtentX" VALUE="600"/> <PARAM NAME="_ExtentY" VALUE="500"/> <PARAM NAME="_StockProps" VALUE="0"/> <PARAM NAME="SRC" VALUE="c#24.pdf" /> </OBJECT>
[解决办法]
点叉叉,然后右键,看看有什么错误。
[解决办法]
你电脑装的PDF阅读器是什么,貌似只能用Acrobat那个
[解决办法]
可以用servlet啊,代码如下:
- Java code
import java.io.FileInputStream;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.ServletOutputStream;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class OutputPdf extends HttpServlet { /** * Constructor of the object. */ public OutputPdf() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //可在tomacat/conf/web.xml中查看各种文件的显示格式:pdf为application/pdf,ppt为application/powerpoint response.setContentType("application/pdf;charset='gb2312'"); FileInputStream fis=new FileInputStream("d:\\struts入门(中文版).pdf"); ServletOutputStream sos=response.getOutputStream(); byte[] buffer=new byte[1024]; int i=0; while((i=fis.read(buffer))!=-1){ sos.write(buffer, 0, buffer.length); } sos.flush(); sos.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here }}
[解决办法]