1

I'm creating an HTML report usgin freemarker, and i produce a PDF from that HTML using ITextRenderer.

ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(baosPDF);

I have a table in that html, with a header that successfully shows on every page using css classes:

thead { display:table-header-group }

Is it possible to do the same trick for an arbitrary section of my document? (let say, a div) I'ld like to keep my html vanilla, and identify the "header" and "footer" i want to see on every page using css.

Is it possible, only with css?

JSlain
  • 566
  • 3
  • 20
  • Found the answer: http://stackoverflow.com/questions/8263416/generating-header-footer-with-flying-saucer-xhtmlrenderer-and-itext – JSlain Apr 10 '17 at 01:07

1 Answers1

1

Perhaps you should have a look at
http://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf

It gives a few examples of converting html to pdf. Including loading an external stylesheet.

Joris Schellekens
  • 8,483
  • 2
  • 23
  • 54
  • This is a paid feature, I'm currently using **flyingsaucer** to convert html to pdf, which i think relies on IText. – JSlain Apr 10 '17 at 01:06
  • The new version of pdfHtml is scheduled to be released under AGPL terms. (Paraphrasing here) Meaning if you are willing to open source your project (to your users), you are free to use to use the open source version of pdfHtml. – Joris Schellekens Apr 10 '17 at 13:55