html 在线预览word exel pdf

word+excle表格在线浏览

通过iframe直接引用微软提供的方法

 在 https://view.officeapps.live.com/op/view.aspx?src= 地址

<iframe src='https://view.officeapps.live.com/op/view.aspx?src=http://storage.xuetangx.com/public_assets/xuetangx/PDF/1.xls' width='100%' height='100%' frameborder='1'>
			</iframe>

pdf在线浏览

PDF.js下载地址

http://jhyt.oss-cn-shanghai.aliyuncs.com/images/1531367199089_PDFObject.js

使用方法

引入pdf.js文件

<script src="./js/PDF/PDFObject.js" type="text/javascript"></script>c

创建有个div用于展示

<div id="example1"></div>

通过js动态添加需要浏览的pdf地址

    var options = {
                height: "550px",
                pdfOpenParams: {view: 'FitV', page: '0' },
                name:"mans",
                fallbackLink: "<p>您的浏览器暂不支持此pdf,请下载最新的浏览器</p>"
            };
    PDFObject.embed(url, "#example1",options);


---------------------
作者:superKM
来源:CSDN
原文:https://blog.csdn.net/superKM/article/details/81013304
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/qq_30202073/article/details/84566335