wkhtmltopdf Table is starting from next page instead of breaking

57 Views Asked by At

Table is starting from next page instead of breaking in the same page, It breaks properly if I reduce few rows or add few rows.

I have break-inside: avoid; in parent container and in Table Row break-inside: avoid; page-break-inside:avoid; page-break-after:auto;

Web URL https://kaingaora-pricelist.co.nz/pdf-test/display

CSS Code looks like

.single-block * {
    page-break-inside: avoid;
    break-inside: avoid;
}

table tr, table .tr {
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: auto;
}

I am using phpwkhtmltopdf 2.5 command used wkhtmltopdf https://kaingaora-pricelist.co.nz/pdf-test/display pdftest.pdf

Below Image is Actual Output vs Expected Output, I would appreciate any help. Thanks enter image description here

1

There are 1 best solutions below

0
shruti On

Adjust Page Break Properties for Tables

.single-block * {
    page-break-inside: auto;
    break-inside: auto;
}

table, table tr, table .tr {
    page-break-inside: auto;
    break-inside: auto;
    page-break-after: auto;
}

Redefine the Parent Container's Properties If the .single-block class is the parent container You might need to adjust or remove the page-break-inside: avoid; and break-inside: avoid;