织梦网页中直接显示pdf文档方法

织梦网页中直接显示pdf文档方法

记录一下主要代码:

<script type="text/javascript" src="/js/pdfobject.js"></script>

<script type="text/javascript">

window.onload = function (){

    var success = new PDFObject({ url: "pdf/CGVET22-08-2011V2P.pdf" ,pdfOpenParams: { scrollbars: '0', toolbar: '0', statusbar: '0'}}).embed("pdf1");

};

</script>

<div id="pdf1" style="width:700px; height:600px;">It appears you don't have Adobe Reader or PDF support in this web browser. <a href="~/pdf/CGVET22-08-2011V2P.pdf">Click here to download the PDF</a></div>

 

PDFObject.js,是一个 JavaScript 库用来在HTML中动态嵌入 PDF 文档。

只需要引用pdfobject.js,不需要额外的库

pdfobject.js下载地址:http://pan.baidu.com/s/1jHJkTvg