Html2Pdf How to Prevent Table Row from Breaking Midway
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...
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;
}