  | 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
|
|
|
  | | | different headers for different section in a PDF | different headers for different section in a PDF 2006-08-01 - By Bruno
Back Leena Kulkarni wrote:
> We are using the following as suggested by you in one of the examples > you shared where PageNumbersWebDraftEventHelper is the class we have > written that has all the onPageEnd etc methods. > > PageNumbersWebDraftEventHelper events = *new > *PageNumbersWebDraftEventHelper(); > writer.setPageEvent(events);
Page Events are the best way to add headers/footers.
> <>HeaderFooter header1 = *new *HeaderFooter(*new *Phrase(),*new > *Phrase("# "+(ID)+" Text"));
HeaderFooter is an obsolete way to add headers/footers.
These are two completely different ways. You can't mix them.
> document.setHeader(header1); > header1.setAlignment(Element.ALIGN_LEFT); > //document is the Document object and is is InputSource object formed > using the XML > //String > XmlParser.parse(document, is); > > It is printing the page numbers and header for us as of now. > > This header is same for the entire PDF. > > We wanted different header for different sections in the PDF.
I suggest that you remove the lines that refer to the HeaderFooter object from your code and that you draw the header in the onEndPage method of your PageNumbersWebDraftEventHelper. I still don't understand at which point you want to change the headers, but the best way to do this, is to add a member variable for the header to the event class and to subclass the XML handler class so that it changes this header when necessary.
best regards, Bruno
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- 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
|
|
 |