1、前端引入js
<script type="text/javascript" src="${pageContext.request.contextPath}/modules/util/downDoc/html2pdf.js"></script>
2、js方法
html定义div
$("#downPrint").click(function () { exportPdf(); }); /*下载Pdf文件*/ function exportPdf() { var content = document.getElementById('div_print'); var options = { margin: 10, filename: '拟文单.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } }; html2pdf().from(content).set(options).save(); }
标签:function,exportPdf,js,content,var,PDF,下载 From: https://www.cnblogs.com/qxqbk/p/17576397.html