【发布时间】:2018-10-08 16:04:39
【问题描述】:
我有以下代码,可在单击 pdf 时生成数据表 pdf。在自定义函数中,我有一个页脚代码,它应该显示页码。
$(document).ready(function () {
//SHOW EXSITING LINE ITEMS
var id = @Model.Order.Id;
table = $("#orders").DataTable({
dom: 'Bfrtip',
buttons: [
{
text: 'Download PDF',
extend: 'pdfHtml5',
className:'btn btn-primary',
orientation: 'landscape',
},
customize: function (doc) {
//set header
doc.content[0].text = "SALES ORDER";
doc.page
doc.pageMargins = [10, 10, 10, 10];
doc.defaultStyle.fontSize = 12;
doc.styles.tableHeader.fontSize = 14;
doc.styles.title.fontSize = 14;
// Set page title
doc.content[0].text = "SALES ORDER";
// Create a footer
doc.footer = (function (page, pages) {
return {
columns: [
'This is your left footer column',
{
// This is the right column
alignment: 'center',
text: ['page ', { text: page.toString() }, ' of ', { text: pages.toString() }]
}
],
margin: [10, 0]
}
});
}
}
],
我添加了如上所示的页脚代码,但我似乎无法在我的 pdf 中获取页脚。我在这里做错了什么?
【问题讨论】:
标签: jquery datatables pdfmake