Issue creating PDF where table bounces to page 2

I just migrated a CF server to Lucee. One problem I’m facing is with PDF generation of an invoice document. These invoices often contain multiple line items that are stored in one large table. The problem is this:

  • If the table contains only a few line items, and will fit on the first page there is no problem
  • If the table is longer and would usually (when rendered on the old CF server) be split across two pages, it is bounced onto the second page
  • If the table is very long e.g. would span more than an entire page on its own, then it renders correctly.

I am using the following syntax:

I tried modern, but could not get the layout to work the way I needed to, so reverted to classic.

I created an image that shows an example of the problem, based on the central table that lists the invoiced items.

Any ideas how I can get it to never force a new page, regardless of the table size?

Thanks.

OS:Windows Server 2022
Java Version: 11.0.18 (Eclipse) 64bit
Tomcat Version: 9.0.71
Lucee Version: 5.3.10.120

What HTML markup and CSS is being used to generate the table? There are some CSS properties that attempt to manage page breaks - maybe the following CSS is set on the table or something around it?

page-break-inside: avoid;

Thanks for the suggestion.

I tried adding it as an inline style directly on the

tag, and also as a
wrapped around the outside of the table, but neither worked.

E.g.

I removed the styles that were being used. (Previously, I had a CFINCLUDE that included the body of the invoice in either the on-screen or PDF version. I split this to a separate file and removed ALL css styles from it).

I even tried wrapping the above DIV tag around all of the tables, to try to group them all together, but it made no difference.

Does the table behave properly if using the ‘modern’ render. I know you said you had other layout problems with that, but if the table works properly with that it may be worth reworking your template to fix your other issues. It is generally much easier to work with the ‘modern’ render as opposed to the ‘classic’ one.

2 Likes

Yes, it works in Modern, so I’ll just work on the styling to get that how I need it.

Thanks again for the ideas!