1. Display pdf on JSP
Http://hi.baidu.com/velercy/blog/item/be708dea2c3236ddd439c9b4.html
<% @ Page Language = "Java" Import = "Java. util. *, Java. io. * "pageencoding =" ISO-8859-1 "%> <% string Path = request. getcontextpath (); string basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/"; %> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <HTML>
2. If Acrobat Reader is not installed on the visitor's computer, use IFRAME or directly use a link to open the file, instead of directly downloading the file. To prevent downloading, imagine how to play a media file, add some official docs, consider using the object tag to embed the PDF plug-in into ie, the result is feasible. Reprinted from: http://hi.baidu.com/cowboy_jia/blog/item/9bf4a6cb2e736afa52664fba.html
<HTML>
3. Display PDF files on the webpage for easy reading. However, if the file size is large, the loading speed will be very slow, and if the client does not install the PDF Reader plug-in, it will not be able to read it, but it will still be pasted out. Do you have to pick it up. (1.pdf to change your PDF file path into the page file) http://hi.baidu.com/xcb521/blog/item/69f0b48aea5377d8fd1f1000.html
HTML code <object classid = "CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.sid "> </Object> <object classid =" CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <par Am name = "_ version" value = "65539"> <Param name = "_ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src" value = "1.20."> </Object> standard browser: java code <Object Data = "1.20." type =" application/pdf "width =" 300 "Height =" 200 "> alt: <a href = "1.20."> testbench </a> </Object> <Object Data =" 1.20." type = "application/pdf" width = "300" Height = "200"> ALT: <a href = "1.p DF "> testpattern </a> </Object> the following methods are available in browsers of ie7.0 and later versions. The earlier version of IE displays the Java code for the two object regions <object classid =" CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.20."> <Object Data = "1.20." type =" application/pdf "wi DTH = "300" Height = "200"> alt: <a href = "1.20."> test.pdf </a> </Object> <object classid =" CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.20."> <Object Data = "1.20." type =" application/pdf" Width = "300" Height = "200"> alt: <a href = "1.20."> testbench </a> </Object> method 1 in earlier browsers: Java code <! -- [If IE]> <object classid = "CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.20."> </Object> <! [Endif] --> <! -- [If! IE]> <! --> <Object Data = "1.20." type =" application/pdf "width =" 800 "Height =" 1050 "> alt: <a href = 'HTTP: // get.adobe.com/cn/reader'> Adobe reader.pdf </a> </Object> <! -- <! [Endif] --> <! -- [If IE]> <object classid = "CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.20."> </Object> <! [Endif] --> <! -- [If! IE]> <! --> <Object Data = "1.20." type =" application/pdf "width =" 800 "Height =" 1050 "> alt: <a href = 'HTTP: // get.adobe.com/cn/reader'> Adobe reader.pdf </a> </Object> <! -- <! [Endif] --> solution 2 in earlier browsers: Hide HTML code by using CSS control/* hides the second object from all versions of IE */* HTML object. hiddenobjectforie {display: none;}/* display the second object only for ie5 Mac * // * ie MAC/* // */* HTML object. hiddenobjectforie {display: inline;}/** // * hides the second object from all versions of IE */* HTML object. hiddenobjectforie {display: none;}/* display the second object only for ie5 Mac * // * ie MAC/* // */* HTML object. hiddenobjectforie {display: inline;}/**/html code <object classid = "CLSID: CA8A9780-280D-11CF-A24D-444553540000 "width =" 800 "Height =" 1050 "border =" 0 "> <Param name =" _ version "value =" 65539 "> <Param name =" _ extentx" value = "20108"> <Param name = "_ extenty" value = "10866"> <Param name = "_ stockprops" value = "0"> <Param name = "src "value =" 1.20."> <Object Data = "1.20." type =" application/pdf "width =" 300 "Height =" 200 "class =" hiddenobjectforie "> alt: <a href = "1.20."> testbench </a> </Object>