Search code examples
htmlpdfhtmldoc

Repeat thead on each page via htmldoc


I'm trying to figure out how to get a set of table headers to repeat on each page of output from htmldoc. I plugged in the CSS way (below) to see if that would work, but I don't believe htmldoc does much of anything with CSS.

The basic question is: Is there a way to make htmldoc act like this CSS when outputting to a PDF?

thead {display: table-header-group;}

Solution

  • HTMLDOC does not support HTML 4.0 elements, attributes, stylesheets, or scripting.

    HTMLDOC is very limited. So you must do that by hand. Calculate when the page break on your table (and force it with ) and repeat the header table.
    Or use an another tool for that . Have you tried xhtml2pdf : https://github.com/xhtml2pdf/xhtml2pdf . It supports css and have an repeat attribute that do this job for table when page break.