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...
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;
}
Have look at WeasyPrint, it’s open-source and converts HTML/CSS to PDF. (I’m the developer.)
WeasyPrint does repeat <thead>
and <tfoot>
on each page, but that’s only for tables. For proper page headers, you can use the Paged Media module of CSS3 (supported in WeasyPrint and some other print-oriented engines)
@page { @top-center { content: "My awesome title"; } }
All the details are in the css3-page spec. At some point I want to write more author-friendly documentation for it, but it’s unfortunately not there yet.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With