tags:

views:

675

answers:

4

Hey everyone,

I have CSS and HTML that I will be converting into PDF. I want to specify a header on each page that, in the PDF, will repeat on each new page.

I know that I can use THEAD to specify the header, however, is there a free html-to-pdf converter that will respect the THEAD tag?

If not, are there any alternatives?

Thanks...

+1  A: 

If this is for one time only, perhaps you can simply open the page in a browser and export to PDF from the Print dialog.

This way, the browser deals with correctly displaying the THEAD elements and you get your PDF output.

Daan
Interesting idea, I will look into this. Thanks.
behrk2
+1  A: 

I really like Prince XML. It respects thead placement, and supports a lot of CSS. It is free for personal use at least.

Ms2ger
I actually looked into Prince XML a lot, and it is very nice. However, ultimately I would need to purchase a server license ($4000), which is quite a bit. I'm looking for more of an open source alternative. Thanks!
behrk2
A: 

For thead to repeat on every page the possible solution is to set it's style to:

@media print {
  thead {
    display: table-header-group;
  }
}

This solves the problem in most browsers, but there is still a problem with dividing table rows on page break, they break in the middle.

Although I do not know if such style is respected in html2pdf converters, there is a possibility to report this requirement to developers of open source converters.

too
+2  A: 

The open source Flying Saucer xhtmlrenderer html-to-pdf converter respects the THEAD tag since release R8 (April 2009). To repeat the THEAD on every page of PDF output, add the following to your CSS:

        table {
            -fs-table-paginate: paginate;
        }
Eero