如何在jsp页面中查看pdf文件并下载相同的pdf?

如何在jsp页面中查看pdf文件并下载相同的pdf?

问题描述:

如何在jsp页面中查看pdf文件并下载相同的pdf?

how to view pdf file in jsp page and download the same pdf?

只需通过iframe嵌入Google Doc Viewer并指定您想要的PDF文件显示。这是你应该添加的代码:



Just embed Google Doc Viewer through an iframe and specify the PDF file you want to display. This is the code you should add:

<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>





那么你只需要将自己的文档文件设置为url查询字符串参数就是这样!您不仅可以在任何浏览器中显示PDF,还可以显示查看器支持的任何其他文件,如doc,xls等!



Then you just need to set up your own document file to the "url" query string param and that's it! You can display not just PDF but any other file supported by the viewer like doc, xls, etc. in any browser!