建立iframe,url访问插件中的viewer.html并传入参数file后面的值为controller层获取pdf文件的输入流
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="xpm" uri="http://www.xinhuagroup.com/xpm" %>
<%@ page isELIgnored="false" %>
<div class="pdf" >
<iframe id ="pdf_page" name ="pdf_page" style="width:100%;height:600px" >
</iframe>
</div>
<script type="text/javascript">
$(function() {
var url = 'sta/libs/pdfjs/web/viewer.html?file='+$.ctx+'/project/prjDesignDraw/getPdfFile/${attachId}/${attachName}';
$('.pdf').find("#pdf_page").attr("src",url);
});
</script>
pdf.js下载
https://download.csdn.net/upload/success