-
Dec 3rd, 2009, 07:45 AM
#1
Thread Starter
Fanatic Member
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
Last edited by vijy; Dec 3rd, 2009 at 07:49 AM.
Visual Studio.net 2010
If this post is useful, rate it
-
Dec 3rd, 2009, 09:19 AM
#2
Re: iTextsharp + Header-Footer.
Hi Vijay,
Hope this helps
Please mark you thread resolved using the Thread Tools as shown
-
Dec 3rd, 2009, 10:07 AM
#3
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.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 4th, 2009, 05:06 AM
#4
Thread Starter
Fanatic Member
Re: iTextsharp + Header-Footer.
Thanks stanav,the code works..
Visual Studio.net 2010
If this post is useful, rate it
-
Jan 4th, 2010, 08:16 AM
#5
New Member
Re: iTextsharp + Header-Footer.
in which version of Itext i will find this object 'HeaderFooter' ?
-
Jan 5th, 2010, 12:42 AM
#6
Thread Starter
Fanatic Member
Re: iTextsharp + Header-Footer.
Visual Studio.net 2010
If this post is useful, rate it
-
Jan 5th, 2010, 08:29 AM
#7
Addicted Member
Re: iTextsharp + Header-Footer.
Please make the thread to "resolved" when your problem fixed!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|