国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > HTML5 > 正文

HTML5在線預覽PDF的示例代碼

2024-09-05 07:22:09
字體:
供稿:網(wǎng)友

簡介

PDF.js is a Portable Document Format (PDF) viewer that is built with HTML5.

PDF.js is community-driven and supported by Mozilla Labs. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs.

開源地址:https://github.com/mozilla/pdf.js

下載后不能直接使用,需要重新構建,不熟悉將會非常麻煩

構建好的程序包:build_jb51.rar

示例

引用文件,直接復制下文可以直接使用

<!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">    <title>課程詳情</title>    <style type="text/css">    </style>    <script src="~/Scripts/jquery-1.10.2.min.js"></script>    <script src="~/Scripts/plugins/pdfjs/pdf.js"></script>    <script src="~/Scripts/plugins/pdfjs/pdf.worker.js"></script>    <script type="text/javascript">        var var_filepath = decodeURIComponent("@filepath");//不能跨域        var var_win_height = $(window).height();        $(document).ready(function () {            resetPlayerSize();         });        $(window).resize(function () {            resetPlayerSize();        });        function resetPlayerSize() {            var_win_height = $(window).height();            $(".tmPlayer").css({ "height": var_win_height + "px" });        }     </script></head><body style="margin: 0;overflow: hidden">     <div id="tmPlayer" class="tmPlayer" style="height: 557px; width: 100%; height: 100%"></div>    <script type="text/javascript">        $('.tmPlayer').html('<iframe frameBorder="0" scrolling="no" src="/Scripts/plugins/pdfjs/generic/web/viewer.html?file=' +            var_filepath +            '" style="width:100%; height:100%;"></iframe>');    </script></body></html>

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 高淳县| 桓台县| 香格里拉县| 濮阳县| 项城市| 桂林市| 湘西| 揭东县| 麦盖提县| 西充县| 杂多县| 黑水县| 广南县| 云龙县| 会理县| 遵义县| 尤溪县| 平安县| 浙江省| 阿鲁科尔沁旗| 乐亭县| 金塔县| 晋江市| 扶余县| 湖北省| 库尔勒市| 巴中市| 铜川市| 长沙县| 恩平市| 临海市| 宁城县| 拜泉县| 永顺县| 三门峡市| 马公市| 无极县| 兰考县| 淮安市| 平顺县| 长丰县|