admin管理员组文章数量:1024603
my code
$("#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');
};
the generated pdf is this
how can i solve this..i want to print the whole table inside in the page...
my code
$("#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');
};
the generated pdf is this
how can i solve this..i want to print the whole table inside in the page...
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Oct 4, 2018 at 12:23 sarathsarath 1631 gold badge2 silver badges11 bronze badges1 Answer
Reset to default 2 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'
},
});
my code
$("#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');
};
the generated pdf is this
how can i solve this..i want to print the whole table inside in the page...
my code
$("#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');
};
the generated pdf is this
how can i solve this..i want to print the whole table inside in the page...
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Oct 4, 2018 at 12:23 sarathsarath 1631 gold badge2 silver badges11 bronze badges1 Answer
Reset to default 2 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'
},
});
本文标签: javascripthow to define width and height in autotableStack Overflow
版权声明:本文标题:javascript - how to define width and height in autotable - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745562819a2156265.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论