iTextsharp + Header-Footer.
Is there any way to assign a image as HeaderFooter for a PDF?
Below code will keep "Hello World" text as heade for all page with some pre-defined font(_oFont22B).
But i am struggling to insert a image.
Code:
Dim header As iTextSharp.text.HeaderFooter = New iTextSharp.text.HeaderFooter(New iTextSharp.text.Phrase("Hello World", _oFont22B), False)
header.Border = iTextSharp.text.Rectangle.NO_BORDER
oDoc.Header = header
Re: iTextsharp + Header-Footer.
Hi Vijay,
Hope this helps
Re: iTextsharp + Header-Footer.
It will be something like this:
Code:
Dim headerImage As String = "full path to your image file here"
Dim img As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(headerImage)
Dim chk As New iTextSharp.text.Chunk(img, 0, 0)
Dim phrs As New iTextSharp.text.Phrase(chk)
Dim hdr As New iTextSharp.text.HeaderFooter(phrs, False)
doc.Header = hdr
Note that the header section of a page is relatively small, so make sure you resize your image to fit into that space first.
Re: iTextsharp + Header-Footer.
Thanks stanav,the code works..
Re: iTextsharp + Header-Footer.
in which version of Itext i will find this object 'HeaderFooter' ?
Re: iTextsharp + Header-Footer.
Re: iTextsharp + Header-Footer.
Please make the thread to "resolved" when your problem fixed!