Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
2.71/5 (3 votes)
See more:
Hello,

I am creating a pdf file using itextsharp. I want to add header and footer for each page in the pdf document. Can anyone tell me how can I do this?

I am using itext 5.0.4.1. In this, I am unable to find the option to use HeadeFooter class, which is available in the earlier versions.

Thanks in advance.
Posted
Updated 24-Sep-10 3:17am
v2
Comments
naser.najafiazar 5-Oct-12 16:02pm    
hiwhenever I want to add a table in PDF footer, the PDF shows it in above of the page instead of footer but for a plaintext, it works well.
I use table because the text is in Persian language.
Can you help me to add table in footer of PDF?

See the below link having video to show you.

http://itextpdf.com/book/chapter.php?id=4

For Header-Footer:
http://kuujinbo.info/cs/itext.aspx


http://www.codeproject.com/KB/graphics/ITextSharpHelperClass.aspx


Please Vote if this helps to you.
 
Share this answer
 
v2
Comments
bedathur_ganesh 24-Sep-10 9:08am    
Thanks for the quick reply.. but, I mean to add header and footer on each page.. but not for a table. Please tell me how to add on each page.

Thanks
NMehta83 24-Sep-10 9:40am    
see the updated answer.
naser.najafiazar 5-Oct-12 16:03pm    
hiwhenever I want to add a table in PDF footer, the PDF shows it in above of the page instead of footer but for a plaintext, it works well.
I use table because the text is in Persian language.
Can you help me to add table in footer of PDF?
 
Share this answer
 
Comments
naser.najafiazar 5-Oct-12 16:03pm    
hiwhenever I want to add a table in PDF footer, the PDF shows it in above of the page instead of footer but for a plaintext, it works well.
I use table because the text is in Persian language.
Can you help me to add table in footer of PDF?
Hiii

Follow below code

C#
PdfTemplate footerTmpl = writer.getDirectContent().createTemplate( 0, 0, pageWidth, footerHeight );

footerTmpl.setFontAndSize( someFont, someSize );
footerTmpl.setTextMatrix( x, y );
footer.showText("blah");



Here, pdftemplate is the itextcharp class.with this you can give footer to each page of your pdf file.

try this hope it will work for you....!!
 
Share this answer
 
Comments
naser.najafiazar 5-Oct-12 16:06pm    
hiwhenever I want to add a table in PDF footer, the PDF shows it in above of the page instead of footer but for a plaintext, it works well.
I use table because the text is in Persian language.
Can you help me to add table in footer of PDF?
Hi
I wrote a blog on how to add headers and footers to your iTextSharp PDF documents. Have a look here, http://www.developerbarn.com/blogs/richyrich/32-using-itextsharp-generate-pdf-header-footer.html[^]

Hope that helps.
 
Share this answer
 
v2
Comments
Chris G. 17-Apr-12 15:25pm    
404 not found. Next time, consider adding the code here.
naser.najafiazar 5-Oct-12 16:06pm    
hiwhenever I want to add a table in PDF footer, the PDF shows it in above of the page instead of footer but for a plaintext, it works well.
I use table because the text is in Persian language.
Can you help me to add table in footer of PDF?
satheeshkumar chinnadurai 24-Jun-15 1:28am    
I need every page footer what i want to....
 
Share this answer
 
Comments
satheeshkumar chinnadurai 24-Jun-15 1:28am    
I need every page footer what i want to....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900