I am using C#. Thanks for caring. I have figured it out and it's resolved. I wanted to add a header to every PDF page created using itextsharp.
The solution is to insert your header before opening the document soon after creating the instance as shown below:
using (PdfWriter writer = PdfWriter.GetInstance(doc, fs))
{
writer.PageEvent = new Header();
doc.Open();
.
.
.
.
.
}