gpt4 book ai didi

javascript - 如何在autotable中定义宽度和高度

转载 作者:行者123 更新时间:2023-12-04 17:44:47 27 4
gpt4 key购买 nike

我的代码

$("#button1").on('click', exportOne);
function exportOne()
{
var pdf = new jsPDF("p", "pt","a4");

var res = pdf.autoTableHtmlToJson(document.getElementById("table2"));

pdf.autoTable(res.columns, res.data);

var res2 = pdf.autoTableHtmlToJson(document.getElementById("table"));
pdf.autoTable(res2.columns, res2.data, {
startY: pdf.autoTableEndPosY() + 16.6
});

pdf.fromHTML($("#otherdivcontent").get(0), 70, 300, {
'width': 500
});

// pdf.autoPrint();

pdf.save('Report.pdf');
};

生成的pdf是这样的 output

我该如何解决这个问题..我想在页面中打印整个表格...

最佳答案

 pdf.autoTable(res2.columns, res2.data, {
startY: false,
theme: 'grid',
tableWidth: 'auto',
columnWidth: 'wrap',
showHeader: 'everyPage',
tableLineColor: 200,
tableLineWidth: 0,
columnStyles: {
0: {
columnWidth: 50
},
1: {
columnWidth: 50
},
2: {
columnWidth: 50
},
3: {
columnWidth: 50
},
4: {
columnWidth: 50
},
5: {
columnWidth: 'auto'
},
6: {
columnWidth: 50
},
7: {
columnWidth: 50
},
8: {
columnWidth: 'auto'
}
},
headerStyles: {
theme: 'grid'
},
styles: {
overflow: 'linebreak',
columnWidth: 'wrap',
font: 'arial',
fontSize: 10,
cellPadding: 8,
overflowColumns: 'linebreak'
},
});

pdf pdf

关于javascript - 如何在autotable中定义宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52646630/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com