Page breaks only if needed

  • I have a report that's being output using phantom-pdf and I want to ensure that if a table is going to have a page break that it will start on a new page (if it then has page breaks in it subsequently I'm okay with that)

    Because the items above it will be variable length, I can't add a consistent number of blank lines to force it to the next page.

    I have tried using the style="page-break-after:auto"... in a div around the table (and it's header. also tried adding the style just to table) which doesn't seem to help. :always unfortunately always starts it on a new page even if the first and second table would have fitted on the one page

    Hopefully there's a solution

  • The css solution is to use page-break-inside:avoid. See the chrome demo

    The default phantomjs doesn't support this, however here seems to be a workaround

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.