Js插件 之pdf.js修改显示标题
一、查找
打开viewer.js
搜索 setTitleUsingUrl定位到代码如图位置
二、修改
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) { this.url = url; try { this.setTitle((TITLE=='' || TITLE == undefined)?(decodeURIComponent(getFileName(url)) || url):TITLE); } catch (e) { // decodeURIComponent may throw URIError, // fall back to using the unprocessed url in that case this.setTitle(url); } },
TITLE就是你定义的标题,使用方法:
<script> var TITLE = 'test'; DEFAULT_URL = "compressed.tracemonkey-pldi-09.pdf"; PDFJS.workerSrc = "./pdf/pdf.worker.js" </script>
三、源码地址
https://gitee.com/yang1015/pdf-reader