node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

Page break on <tr>

Open Brendan92 opened this issue 8 years ago • 6 comments

When adding 'tr style="page-break-after: always !important;" ' nothing happens, where 'tr' is the html tag. Is there any way to force a page break in a table on a specific table row without setting it's style="display: block" or style="display: inline-block"? Changing the display property, the page break works but then i'm finding it impossible to correct the styling of the entire table.

Brendan92 avatar Jan 26 '17 14:01 Brendan92

this is working for me:

<td>
  <div class="avoid">
    Cell content.
  </div>
</td>
...
<style type="text/css">
  .avoid {
    page-break-inside: avoid !important;
    margin: 4px 0 4px 0;  /* to keep the page break from cutting too close to the text in the div */
  }
</style>

https://stackoverflow.com/questions/9288802/avoid-page-break-inside-row-of-table

alan345 avatar Oct 18 '17 22:10 alan345

Hi, post is older i know, but i was struggeling with this too. I solved it when i removed the bootstrap class "table-responsive". This was the error for me.

DSc5 avatar Nov 22 '17 20:11 DSc5

I'm having the same issue and the stackoverflow suggestions are not working. The suggestions work fine when printing from all browsers I've tried, but they don't work with this package.

trmpowell avatar Jun 17 '19 03:06 trmpowell

In my case I print <table> for every row, but it's ugly solution.

GvadimI avatar Mar 11 '20 13:03 GvadimI

@GvadimI Do you have an example that you could share?

pmaganti avatar Aug 20 '20 17:08 pmaganti

In my case I print <table> for every row, but it's ugly solution.

It works for me too

chavaleon avatar Mar 28 '23 19:03 chavaleon