JSlain
JSlain

Reputation: 576

Adding Header or Footer on every page using ITextRenderer from HTML

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?

Upvotes: 1

Views: 2105

Answers (1)

Joris Schellekens
Joris Schellekens

Reputation: 9012

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.

Upvotes: 1

Related Questions