Recently there is a need to implement a direct view of the Pdf,word,excel file on the Web page. But in fact there is no good open source plug-in for us to use, there are some paid plug-in good, but also very useful, but for me is not suitable.
Now it's just a simple way to find the Pentangeli.
is to implement the display of the PDF file, and other files to be converted to PDF in other ways. Although this method is really bad, but there is no way to do, if the future can have a better, then publish something else.
Here I will directly introduce the PDF display method.
Directly on the dry goods.
First copy the following file under the E:\tomcat8\webapps directory
Http://yunpan.cn/cwmjKF6jKY6Kb access Password c14a
Just like this.
Then open tomcat
Then the browser accesses http://localhost:8080/generic/web/viewer.html
See if a PDF plugin appears
Then open the Generic/web/viewer.js file with Notepad
Modified to var default_url = ';
Then you give a link to any of the items http://localhost:8080/generic/web/viewer.html?file=http://localhost:8080/resources/spring.pdf
Just give one behind the http://localhost:8080/generic/web/viewer.html? File= back with the address of the PDF file you need to access, open such a link can be directly in the page to write the PDF file.
It is important to note that the browser must support HTML5
Incidentally, this is an open source plug-in, Firefox comes with it, so Firefox opens the PDF without this is also possible, but IE will not. So this plugin is needed. This plugin is still very good, very easy to get started, coupling is not high, there is no bug.
Ideas and resources from the following two posts, thank the great God.
Http://www.cnblogs.com/kagome2014/archive/2015/05/26/kagome2014001.html
Http://www.cnblogs.com/studyzy/p/5338398.html
How to view PDF files online in Javaweb project