7 Star 128 Fork 31

gjTool/pdfh5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 14.36 KB
一键复制 编辑 原始数据 按行查看 历史
gjTool 提交于 2024-02-29 09:56 . 修复bugs
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="msapplication-tap-highlight" content="no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="pdfh5.js,pdf.js,gjTool,gjtool.cn,www.gjtool.cn,gjTool.js,移动端展示预览打开pdf,手机端展示预览打开pd" />
<meta name="description" content="pdf.js移动端展示预览打开pdf-pdfh5.js" />
<title>pdf.js移动端展示预览打开pdf-pdfh5.js</title>
<link rel="stylesheet" href="css/style.css" />
<link href="//www.gjtool.cn/download/pdfh5.png" type="image/x-icon" rel="shortcut icon" />
<style>
html,
body {
width: 100%;
height: 100%;
}
.docs-header-content {
max-width: 388px;
float: left;
position: relative;
padding: 50px 10px;
text-align: center;
-webkit-animation-name: fadeintext;
-moz-animation-name: fadeintext;
animation-name: fadeintext;
-webkit-animation-duration: 2s;
-moz-animation-duration: 2s;
animation-duration: 2s;
background: #fff;
}
.docs-subtitle {
max-width: 750px;
margin: 0 auto 20px;
font-size: 28px;
font-weight: 300;
line-height: 38px;
color: #d64c28;
margin-bottom: 30px;
font-size: 41px;
line-height: 60px;
}
.github-btn {
overflow: hidden;
border: 0;
}
.phone {
margin: 10px auto;
position: relative;
background: #111;
border-radius: 55px;
box-shadow: 0px 0px 0px 2px #aaa;
width: 270px;
height: 358px;
padding: 105px 25px;
-webkit-box-sizing: content-box;
box-sizing: content-box;
float: right;
transform: translateX(-8%);
}
.phone iframe {
width: 270px;
height: 100%;
display: block;
width: 100%;
margin-top: 15px;
}
.phone:before {
content: '';
width: 60px;
height: 10px;
border-radius: 10px;
position: absolute;
left: 50%;
margin-left: -30px;
background: #333;
top: 50px;
}
.phone:after {
content: '';
position: absolute;
width: 60px;
height: 60px;
left: 50%;
margin-left: -30px;
bottom: 20px;
border-radius: 100%;
box-sizing: border-box;
border: 5px solid #333;
}
.phone .statusbar {
position: absolute;
width: 270px;
height: 15px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAAoCAIAAADhf9zeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6REEyN0EzRUU1QzM3MTFFNEE1ODA5RkNEOEU4MEU4ODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6REEyN0EzRUY1QzM3MTFFNEE1ODA5RkNEOEU4MEU4ODYiP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lpdS0Oc86dO0dKq/F/IiAjr6kopodiO6iZzaMfggFrryNsaGhYtGjRuySpDi3xQXY25AwQLdCBmtMKduDkyZPIunjBjYAgXuQHi2M4h82DNxv6j5KSEuo8JMPKw68CRd++fceOHYsI77fffrt8+bJeoL6+Hg28Q4cOkLS6HId5BAaFpLmt8mAXUmOxHouimN6uFhYWwqJmZWVp0m45mXabQwvu3bvn8z4AFTy74Pw+YOOIzHABfcp9NYpCymGSSmrmJUPbXHU2ypKGdSA8WyDm0aNHGRkZ1dXVMTEx169fhz/mWb9+RdxNfbgmcoI8J/p9rb7Z0K/UOhHWsA2mKcGAw+FISUmB90UTvnTpkl6gT58+0BmIoXXrVyLyvu8Hhis/Px/+tby8nAbGk4GSfa2imAyNftA/goHDxnHQOmjUlXiXq0klnzx5Atc7f/78HTt2+LYPwC137tzJycnBSVEH1lXPMZkHjOgSSqDpXfHgdYRuJc3nIns54CUxMfHatWv9+vXje+1DLA10kodTuUJ/qEANwhKBguG7GXgQlp1ERUWJHixCrAWNdk0LRH/66afqr4s2UQATXZJfYKp/UaCimMhGTF5+Q5YQn7R2uuH8eBm46oqKCptdrwCJDc6+efNmS3u1Y7Vua6DRcs+zbyH3o9hvDMvidkkB/aHkvdSnAH3kJMxKn7bhfxFnv+lEf/wArvjWxtuy7JbgqA4fPtzS0uK9MhvqGC0RSGs+m8xhUxSDRhl2Pmv6ipKTk8OcK7W5VWBcjYKCgjlz5kRHR9t/LxBnlJaWrly50pJ1ZQfMMAwT8g64oaHh4MGDXnpfxmYcfAkYhmFCmsbGRva+7IAZhmEYW7l9+zZ7X4ZhGIaxj4iIiEmTJrVvz5NZGIZhGIZhlOEuaIZhGIZhB8wwDMMw7IAZhmEYhvET/wowADOhvI/6on5eAAAAAElFTkSuQmCC');
left: 50%;
margin-left: -135px;
top: 104px;
-webkit-background-size: 100% auto;
background-size: 100% auto;
}
:before,
:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.phone-link {
position: absolute;
width: 100%;
top: 100%;
left: 0;
text-align: center;
margin-top: 25px;
margin-bottom: 25px;
}
a,
a:focus,
a:active,
a:visited {
color: #018efb;
text-decoration: underline;
}
ol {
width: 90%;
margin-left: 40px;
list-style: decimal;
text-align: left;
}
ol li {
margin: 10px 0;
}
</style>
</head>
<body>
<div style="max-width:1024px;margin:0 auto;">
<div class="docs-header-content" style="transform:none;-webkit-transform:none;">
<p class="docs-subtitle">pdfh5.js - 移动端预览PDF插件,基于pdf.js和jQuery</p>
<a href="//github.com/gjTool/pdfh5"
style="display:block;margin-bottom:30px;">
<div id="code"></div>
</a>
<iframe class="github-btn"
src="//ghbtns.com/github-btn.html?user=gjtool&amp;repo=pdfh5&amp;type=watch&amp;count=true" width="100"
height="20">
</iframe>
<iframe class="github-btn"
src="//ghbtns.com/github-btn.html?user=gjtool&amp;repo=pdfh5&amp;type=fork&amp;count=true" width="100"
height="20">
</iframe>
<p style="text-align: left;margin-top: 20px;">本插件所需文件如下:</p>
<ol>
<li><a target="_blank" download="cmaps.zip"
href="//www.gjtool.cn/download/cmaps.zip">cmaps文件夹-解决字体不全问题(下载压缩包解压) 下载大小:969kb</a></li>
<li><a target="_blank" download="pdf.js" href="//www.gjtool.cn/pdfh5/js/pdf.js">pdf.js 下载大小:317kb</a></li>
<li><a target="_blank" download="pdf.worker.js" href="//www.gjtool.cn/pdfh5/js/pdf.worker.js">pdf.worker.js
下载大小:749kb</a></li>
<li><a target="_blank" download="js"
href="//www.gjtool.cn/pdfh5/js/jquery-2.1.1.min.js">jquery-2.1.1.min.js 下载大小:94kb</a></li>
<li><a target="_blank" download="pdfh5.js" href="//www.gjtool.cn/pdfh5/js/pdfh5.js">pdfh5.js 下载大小:22kb</a>
</li>
<li><a target="_blank" download="pdfh5.css" href="//www.gjtool.cn/pdfh5/css/pdfh5.css">pdfh5.css 下载大小:9kb</a>
</li>
</ol>
</div>
<p style="text-align: left;margin-top: 20px;padding-left: 10px;">pdfh5支持在线预览,修改地址栏file=后的地址就行,如果不填写,就在实例化的时候传入pdf地址:</p>
<a target="_blank"
href="//www.gjtool.cn/pdfh5/pdf.html?file=//www.gjtool.cn/pdfh5/test.pdf" style="padding-left: 10px;">http://www.gjtool.cn/pdfh5/pdf.html?file=//www.gjtool.cn/pdfh5/test.pdf</a>
<p style="text-align: left;margin-top: 20px;padding-left: 10px;">
默认优先获取浏览器地址栏?file=后面的地址,如果地址栏没有,再拿配置项的pdfurl或者data来渲染pdf。pdfh5实例初始化:</p>
<pre style="text-align: left;margin-top: 20px;background: #111;color:aqua">
var pdfh5 = new Pdfh5('.pdfjs', {
pdfurl: 'default.pdf'
});
</pre>
<div class="phone">
<iframe src="pdf.html" frameborder="0" scrolling="no"></iframe>
<div class="statusbar"></div>
<a href="pdf.html" target="_blank"
style="display:block;width:60px;height:60px;position: absolute;bottom:20PX;left:50%;margin-left: -30px;z-index:100;"></a>
<p class="phone-link">
<a target="_blank" href="pdf.html">Open it in a new page</a>
</p>
<p style="position: absolute;bottom: -96px;left: 0;color: #777;font-size: 14px;
text-indent: 70px;">鄂ICP备19002193号-1</p>
</div>
</div>
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/jquery.qrcode.min.js"></script>
<script>
$('#code').qrcode(location.href);
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?d924028c274d650b6f12d391ec251143";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function () {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gjTool/pdfh5.git
git@gitee.com:gjTool/pdfh5.git
gjTool
pdfh5
pdfh5
master

搜索帮助