1、PDF.js获取当前页。 你只需要打开了PDF文件,然后你打开浏览器检查(Fn+f12)
这里就有你想要的东西。是不是让你一顿好找!
2、从指定页面加载
在你的项目中找到 viewer.js 我是uniapp的项目 如果你在VUE中使用 应该也可以找到对应的
给这里增加以下代码:
//获取url
var c_url=window.location.href;
console.log(c_url,'pdfurl')
//获取参数
if(c_url.indexOf("&")&&c_url.indexOf("=")){
var c_urlArray={}
var c_val=c_url.split('?')[1];
var c_valArray=c_val.split('&');
console.log(c_valArray,'c_valArray')
for(let i=0;i<c_valArray.length;i++){
let c_key=c_valArray[i].split('=')[0];
let c_value=c_valArray[i].split('=')[1];
c_urlArray[c_key]=c_value;
}
//跳转至指定页码
if(c_urlArray['page']){
document.getElementById('pageNumber').value = c_urlArray['page']*1;
this.pdfViewer.currentPageNumber = c_urlArray['page']*1;
console.log(this.pdfViewer.currentPageNumber,'this.pdfViewer.currentPageNumber==')
}
}
3、在把你的pdf地址后面拼接
viewerUrl: '/hybrid/html/web/viewer.html', 这是我项目中的目录仅作参考
1、PDF.js获取当前页。 你只需要打开了PDF文件,然后你打开浏览器检查(Fn+f12)这里就有你想要的东西。是不是让你一顿好找!2、从指定页面加载 在你的项目中找到 viewer.js 我是uniapp的项目 如果你在VUE中使用 应该也可以找到对应的 给这里增加以下代码://获取url var c_url=window.location.href; console.log(c_url,'pdfurl') //获取参数...
<div class="preview-
pdf
">
<h1>
PDF
页数
为{{
pdf
Pages}}</h1>
<div :style="`margin:0 auto;width:${
pdf
Width};`">
<canvas
v-for="page in
pdf
Pages"
:key="page"
4 * @param filePath
5 * @return Map<String, List<Map<String, String>>>
6 * @author 龙谷情
7 ...
1.使用模板(viewer.html)的方式加载
pdf
文件
页面:<iframe id="
pdf
Box" frameborder="1" width="1116" height="758"></iframe>
<input type="hidden" id="hasReadPageNum"&
Fullpage.js version 3 has changed its license to GPLv3 and it requires a `licenseKey` option. Read a