pdf.js实现
springboot项⽬
resources/js/pdf/web/viewer.html是要被访问到的,不能被过滤器过滤。1、前端页⾯
$('#proBase').click(function () {
var curWwwPath=window.document.location.href;var pathName=window.document.location.pathname;var pos=curWwwPath.indexOf(pathName);var localhostPath=curWwwPath.substring(0,pos);
window.open(localhostPath+\"/resources/js/pdf/web/viewer.html?file=\"+propertyBaseUrl);})
其中localhostPath+\"/resources/js/pdf/web/viewer.html是获取项⽬中pdf.js的模板;file=后⾯是pdf⽂件url路径;
1、后端:将pdf.js⽂件导⼊到项⽬中,就可以完成。