Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jspdf - Insert text after table

I am using jsPDF and jsPDF-AutoTable to create and print a report. But I want to insert a text right below the table. But, as it is a dynamic table, I can't tell doc.text() the y coordinate from where to write the text. Has anyone done that before? Thanks in advance

like image 911
Andy Torres Avatar asked Apr 11 '17 19:04

Andy Torres


1 Answers

You can use the doc.autoTable.previous.finalY property like this:

doc.autoTable({html: '#table'});
let finalY = doc.lastAutoTable.finalY; // The y position on the page
doc.text(20, finalY, "Hello!")

See the with content example for sample code.

like image 54
Simon Bengtsson Avatar answered Sep 17 '22 13:09

Simon Bengtsson