  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Adding Header Footer in the PDF document | Adding Header Footer in the PDF document 2006-07-28 - By Swati Pathak
Back Hello,
I am using iTextSharp version 3.1.2 for PDF creation. My requirement is to add Header and Footer in the document. I tried using HeaderFooter object using following lines of code
HeaderFooter header = new HeaderFooter(new Phrase("Selection Report"), false);
myDocument.Header = header;
The Header is not getting added in the document.
Graphic grx = new Graphic();
grx.DrawHorizontalLine(1, iTextSharp.text.Color.BLACK, 10, 10, myDocument.PageSize.Width);
grx.Stroke();
myDocument.Add(grx);
The horizontal line is also not getting added in the document using above line of code.
Could you please let me know if anything is wrong in the code and how to add Header, Footer and horizontal line?
Your earliest help is most appreciated.
__ ____ ____ ____ ____ __
Thanks & Regards
*Swati Pathak*
<p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hello,</span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I am using iTextSharp version 3.1.2 for PDF creation. My requirement is to add Header and Footer in the document. I tried using HeaderFooter object using following lines of code </span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT -FAMILY: Arial"> </span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">HeaderFooter header = new HeaderFooter(new Phrase(" ;Selection Report"), false);</span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">myDocument.Header = header;</span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span> </font></p> <p class="MsoNormal"><font face="Arial" color="#333399" size="2"><span style= "FONT-SIZE: 10pt; COLOR: #333399; FONT-FAMILY: Arial">The Header is not getting added in the document. </span></font><font face="Arial" size="2"> <span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Graphic grx = new Graphic();</span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">   ; grx.DrawHorizontalLine(1, iTextSharp.text.Color.BLACK, 10, 10, myDocument.PageSize.Width);</span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">   ; grx.Stroke();</span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">   ; myDocument.Add(grx);</span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p> <p class="MsoNormal"><font face="Arial" color="#333399" size="2"><span style= "FONT-SIZE: 10pt; COLOR: #333399; FONT-FAMILY: Arial">The horizontal line is also not getting added in the document using above line of code.</span> </font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Could you please let me know if anything is wrong in the code and how to add Header, Footer and horizontal line?</span></font> <font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font></p> <p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Your earliest help is most appreciated.</span></font><font face="Verdana" size="2"><span style="FONT-SIZE: 10pt"> </span> </font></p> <p class="MsoNormal" style="MARGIN-BOTTOM: 5pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 5.0pt"><font face="bo" color="navy" size="2"><span style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: bo">__ ____ ____ ____ ____ __ </span></font><font face="Arial" color="black"><span style="COLOR: black; FONT -FAMILY: Arial"></span></font></p> <p class="MsoNormal" style="MARGIN-BOTTOM: 5pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 5.0pt"><font face="Arial" color="black" size="2"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Thanks & Regards </span></font><font face="Times New Roman" color="navy" size="3"><span style= "FONT-SIZE: 12pt; COLOR: navy; FONT-FAMILY: 'Times New Roman'"></span></font></p > <p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><b><font face="Verdana" color="#333399" size="1"><span lang="FR" style= "FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #333399">Swati Pathak</span> </font></b></p>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions
|
|
 |