Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSPDF Autotable breaks rows

In web app I'm using the JSPDF Autotable to build a PDF. The problem is that the data will be dynamic (I'm going to use AngularJS 1.x) and so the rows can have differents height.

In some cases, Autotable breaks the last row of the page, continuing to the next one. How can I prevent this behavior, and set up Autotable to take the last row (which default would break) and bring it to the next page?

This is my code: https://jsfiddle.net/9vgxvfkh/1/

I guess I have to change some settings in the style:

styles: {
    cellPadding: 1.5,
    overflow: 'linebreak',
    valign: 'middle',
    halign: 'center',
    lineColor: [0, 0, 0],
    lineWidth: 0.2 
},
pageBreak: 'always'

But I tried, and it didn't work.

P.S.: The margin top on the header is because then I will add an image.

like image 671
panagulis72 Avatar asked Mar 09 '23 04:03

panagulis72


1 Answers

Using the latest version this particular example is fixed. But for other cases where you don't want a multi line row to be split you can use rowPageBreak: 'avoid'.

like image 62
Simon Bengtsson Avatar answered Mar 19 '23 03:03

Simon Bengtsson