Javascript 在自动表之前添加div内容
我正在使用这些插件 ** 1) jspdf.plugin.autotable.js 2) jspdf.debug.js** Iam使用以下代码Javascript 在自动表之前添加div内容,javascript,jspdf,jspdf-autotable,Javascript,Jspdf,Jspdf Autotable,我正在使用这些插件 ** 1) jspdf.plugin.autotable.js 2) jspdf.debug.js** Iam使用以下代码 var pdf = new jsPDF("p", "pt"); pdf.fromHTML($("#otherdivcontent").get(0), 70, 300, { width: 500 }); var res = pdf.autoTableHtmlToJson(document.getElementById("table2")); pdf.au
var pdf = new jsPDF("p", "pt");
pdf.fromHTML($("#otherdivcontent").get(0), 70, 300, {
width: 500
});
var res = pdf.autoTableHtmlToJson(document.getElementById("table2"));
pdf.autoTable(res.columns, res.data);
pdf.autoPrint();
pdf.save("Report.pdf");
剧本
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="jspdf.debug.js"></script>
<script type="text/javascript" src="jspdf.plugin.autotable.js"></script>
这是生成的pdf
我想把这两个内容合并成一个pdf…我想把div内容放在表格之前…请帮我调整对齐方式。我想把表格放在第二页。。。
我怎样才能解决这个问题 这是解决方案
pdf.fromHTML($("#test1").get(0), 30,100, {
'width': margins.width
},
margins);
pdf.autoTable(data.columns, data.rows,
{margin: {top: 80,bottom:50},
startY:h+20,
tableWidth: 500,
styles: {
overflow: 'linebreak',
columnWidth: 'wrap',
// rowHeight:'wra',
lineWidth: 1
}});
“h”是div#test1的高度。iam使用“jspdf.min.js”而不是“jspdf.debug.js”