Click here to Skip to main content
11,720,374 members (80,532 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET PDF
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 22-Sep-10 20:49pm
Edited 24-Sep-10 3:17am
v2
Comments
naser.najafiazar at 5-Oct-12 16:02pm
   
hi
whenever 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Comments
bedathur_ganesh at 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 at 24-Sep-10 9:40am
   
see the updated answer.
naser.najafiazar at 5-Oct-12 16:03pm
   
hi
whenever 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

  Permalink  
Comments
naser.najafiazar at 5-Oct-12 16:03pm
   
hi
whenever 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hiii

Follow below code

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....!!
  Permalink  
Comments
naser.najafiazar at 5-Oct-12 16:06pm
   
hi
whenever 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Comments
Chris G. at 17-Apr-12 15:25pm
   
404 not found. Next time, consider adding the code here.
naser.najafiazar at 5-Oct-12 16:06pm
   
hi
whenever 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 at 24-Jun-15 1:28am
   
I need every page footer what i want to....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

  Permalink  
Comments
satheeshkumar chinnadurai at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 2,029
1 OriginalGriff 844
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540


Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 13 Sep 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100