I am trying to use html2pdf to download the HTML page as PDF however if the content of the table is too long, it tends to break the TR midway through.
Any solutions for this issue?
Attempted Solutions (None worked)
Solution #1: pagebreak: { avoid: ['tr', 'td'] }
var opt = {
margin: 0.5,
filename: dashboard_name + '_' + client_name + '.pdf',
pagebreak: { avoid: ['tr', 'td'] },
image: { type: 'jpeg', quality: 1 },
html2canvas: { dpi: 192, width: $(window).width()},
jsPDF: {
orientation: pageOrient,
unit: 'cm',
format: 'a2',
compress: true
}
};
Solution #2: Adding page break CSS
@media print {
table, div {
break-inside: avoid;
}
}
thead { display: table-header-group; }
tfoot { display: table-row-group;}
tr {
page-break-after: always!important;
page-break-before: always!important;
page-break-inside: auto!important;
}
Solution #3: ` pagebreak: {
mode: ['avoid-all', 'css', 'legacy']
},`
However, the table row is still breaking across 2 pages as depicted in the image below.



