获取包装在自动表jsPDF中的自定义文本

时间:2018-07-26 10:09:00

标签: javascript jspdf jspdf-autotable

我有一个要求,其中需要使用jsPDF在PDF上生成表/自动表。

我可以使用以下链接生成表格并下载PDF: https://github.com/simonbengtsson/jsPDF-AutoTable

但是,生成的表必须与所附的屏幕截图类似。

enter image description here

我该如何进行?

1 个答案:

答案 0 :(得分:0)

您可以通过以下方式进行操作。

  

不建议使用此autoTableEndPosY

pdf.autoTable({
 //....
});

let y = pdf.autoTableEndPosY();
pdf.text(x, y+10,'This is Text');
//add 10 (or any number of choice) to y for adding space between table and text

请立即使用以下代码

pdf.autoTable({
     //....
});

let y = pdf.autoTable.previous.finalY;
pdf.text(x, y+10,'This is Text');
//add 10 (or any number of choice) to y for adding space between table and text