Q: Add page header and footer to pdf using itext xmlworker i want to add a page header and page footer to my generated pdf. I use xmlworker for convert my html content to pdf. 
I want to add a page header and page footer in every page of generated pdf, i have problems to do this task. How can i do this?

A: You have to implement an HeaderFooter class for your document which implements itexts PdfPageEventHelper class.
Just take a look at this example.
You want to create a header on each page, so you will just need to override the onEndPage() method.
Adding a footer can be done with this methode aswell. You can do so by adding content to the directContentByte using coordinates for the pages bottom like this:
ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("test"), 
                            rect.getRight()-35, rect.getBottom()-25, 0);

