html 線上預覽word exel pdf
阿新 • • 發佈:2018-11-30
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
版權宣告:本文為博主原創文章,轉載請附上博文連結!