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

thead and tbody get mixed starting from second page

Open gmartini20 opened this issue 10 years ago • 11 comments

I'm creating a pdf from a html with thead and tbody tags, I have already removed all style I had and I'm still with the same problem.

Starting from second page the tbody overwrite thead, like on image bellow:

screen shot 2015-07-17 at 11 24 02

It is very strange because it works on the first page (image below) and I don't have any style on this page.

screen shot 2015-07-17 at 11 26 10

It seems to happened too with the guy who opened this issue: https://github.com/marcbachmann/node-html-pdf/issues/36. But he didn't want to have table headers on all pages, I want to.

Do you ever experienced this problem? Is there a way to solve it?

gmartini20 avatar Jul 17 '15 14:07 gmartini20

Is there any known solution?

IonicaBizau avatar Aug 09 '15 11:08 IonicaBizau

Having the same issue here.

agilbert314 avatar Aug 28 '15 21:08 agilbert314

Any luck?

kodamirmo avatar Nov 29 '15 06:11 kodamirmo

@kodamirmo In the latest release of nodeice, I switched to the phantom-html-to-pdf package by @pofider which doesn't have this bug. :sparkles:

IonicaBizau avatar Nov 29 '15 07:11 IonicaBizau

@IonicaBizau and @kodamirmo .... phantom-html-to-pdf has the same bug if you set the orientation the landscape :-(

pageSize: {
     orientation: 'landscape'
}

morficus avatar Nov 30 '15 01:11 morficus

That maybe works. https://github.com/marcbachmann/node-html-pdf/issues/36#issuecomment-110530819

marcbachmann avatar Nov 30 '15 07:11 marcbachmann

Sitting the proper css rules seemed to work for me:

thead {
  display: table-header-group;
}

tr {
  page-break-inside: avoid;
}

Headers repeated correctly without overlap. One trick is that you can't have any of those rules inside of a @print media rule, as it seems that it can't calculate the repeating headers correctly when doing so.

scurker avatar Jan 18 '16 22:01 scurker

I seem to be unable to get this to work on my end. A working example of this would be greatly appreciated :)

mdelorimier avatar Jan 27 '17 15:01 mdelorimier

I've been unable to get it to repeat headers, using v2.1 of this lib. Any update?

This might be related: https://github.com/ariya/phantomjs/issues/13324 https://github.com/ariya/phantomjs/issues/13524

sonu27 avatar Mar 08 '17 15:03 sonu27

Same here. Did you find a workaround in the meantime @sonu27?

haschu avatar Jul 03 '17 14:07 haschu

Hi,

table thead section is not repeating after page break. I am using simple html.

header
data

Is anyone found solution?

Regards, Rohit

rohitrelay avatar Sep 27 '19 15:09 rohitrelay