Chrome-PDF page break on split page table rows?



  • I've tried reading the chrome-pdf docs and what I can find about headless Chrome, but I can't find what I'm looking for. I'm trying to find a way to make chrome-pdf document rendering to force page breaks if a <tr> splits onto two pages.

    I know this is probably very difficult, if possible at all, as the size of the page and the content in it aren't necessarily known until after it's rendered. But does anyone know if there's a way? It would just make the output of my documents (which are heavily table-reliant) look cleaner.



  • Unfortunately I don't see a way how to solve this.
    The css page-break-inside and page-break-after. doesn't seem to help in this case.



  • Thanks for the reply, I suspected so but thought it was worth asking.



  • Ugh. I'd like to find something similar. There's another module I was using elsewhere - html2pdf.js (https://www.npmjs.com/package/html2pdf.js) which was able to split pages using the avoid mode of page breaks so that I wouldn't get items split in the middle of open/close tags. Obviously, I had to choose items that would be reasonable in size - nothing that would be larger than a page, but it worked. I'm not using it now because the middle link of a three-step chain for that module was too slow for long reports. Plus, it was client-side rendering and couldn't do scheduled jobs or be saved to the server.



  • Never mind. It does work presently. I thought I had tried what I used in that other module, but I guess I had a typo before. So I looked it up again, and it's the page-break-inside: avoid; property. I'm now able to prevent splitting a DIV and its contents between pages. This was particularly ugly when it wasn't working because these particular DIVs have borders. I imagine it should work for other elements too.


Log in to reply
 

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