Java Mailing List Archive

http://www.junlu.com/

Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Adding Header Footer in the PDF document

Adding Header Footer in the PDF document

2006-07-28       - By Swati Pathak

 Back
Reply:     1     2  

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">&nbsp;</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(&quot
;Selection Report&quot;), 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">&nbsp;</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.&nbsp;</span></font><font face="Arial" size="2">
<span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp; 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp; grx.Stroke();</span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp; myDocument.Add(grx);</span></font><font face="Arial" size="2"><span
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
&nbsp;</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">&nbsp;</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">
&nbsp;</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">&nbsp;</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 &amp; 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

©2008 junlu.com - Jax Systems, LLC, U.S.A.