Not sure about existing HeaderFooter classes, I don't use those. In my situation, a main table is first added to the page -- using a simple document.add(table) -- , then the header & footer tables are added on the endPageEvent. The main table is automatically positioned between the header & footer tables w/out any overlapping.
-----Original Message----- From: Eric B. [mailto:[email protected]] Sent: Wednesday, May 27, 2009 3:54 PM To: [email protected] Subject: Re: [iText-questions] Any way to put a PdfPTable in a Header? Thanks. Am not quite sure how that works, but definitely seems promising. How does it handle any HeaderFooter classes that may have been added to the page already? Would this not overwrite them? Furthermore, if this is onEndPage, what happens to the text that has already been added to the page? Does it get pushed below the header? Or does the header overlap anything that is under it since you are writing to a specific location on the page? Thanks, Eric "Singh, Vikram" <[email protected]> wrote in message news:2a85a353ff683d4a9991b74845f6f66202382...@pacr-srv-mail08.cvty.com.. . >I do this on an EndPage event, seems to work fine > > > /** > * Inner class that adds headers and footers to page(s) > */ > private class EndPage extends PdfPageEventHelper { > > public void onEndPage(PdfWriter writer, Document document) > { > try > { > Rectangle page = document.getPageSize(); > > PdfPTable header = buildHeaderTable(document); > header.writeSelectedRows(0, -1, document.leftMargin(), > page.getHeight() > - (document.topMargin()) + header.getTotalHeight(), > writer.getDirectContent()); > > PdfPTable footer = buildFooterTable(document); > footer.writeSelectedRows(0, -1, document.leftMargin(), 38, > writer.getDirectContent()); > > } > catch (Exception e) > { > throw new ExceptionConverter(e); > } > } > > } > > -----Original Message----- > From: Eric B. [mailto:[email protected]] > Sent: Wednesday, May 27, 2009 3:13 PM > To: [email protected] > Subject: [iText-questions] Any way to put a PdfPTable in a Header? > > Hi, > > I've got a table that I need repeated on every page. I realize that I > could probably do this on a onStartPage event, but that would end up > breaking some existing code. I was hoping to be able to simply create > a HeaderFooter object and include the table in there, but it seems > that HeaderFooters only accept Phrases or Chunks. > > Is there anyway to put a Table in the header of the page, or is the > onStartPage really the only way possible? > > Thanks, > > Eric > > > > > ---------------------------------------------------------------------- > -- > ------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. > Meet the minds behind Google Creative Lab, Visual Complexity, > Processing, & iPhoneDevCamp as they present alongside digital > heavyweights like Barbarian Group, R/GA, & Big Spaceship. > http://p.sf.net/sfu/creativitycat-com > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ You can also search the keywords list: > http://1t3xt.info/tutorials/keywords/ > > > > > > > Email Confidentiality Notice: The information contained in this > transmission is confidential, proprietary or privileged and may be > subject to protection under the law, including the Health Insurance > Portability and Accountability Act (HIPAA). > > The message is intended for the sole use of the individual or entity > to whom it is addressed. If you are not the intended recipient, you > are notified that any use, distribution or copying of the message is > strictly prohibited and may subject you to criminal or civil > penalties. If you received this transmission in error, please contact > the sender immediately by replying to this email and delete the material from any computer. > > > > ---------------------------------------------------------------------- > -------- Register Now for Creativity and Technology (CaT), June 3rd, > NYC. CaT is a gathering of tech-side developers & brand creativity > professionals. > Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp as they present alongside digital heavyweights like > Barbarian Group, R/GA, & Big Spaceship. > http://p.sf.net/sfu/creativitycat-com > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ > You can also search the keywords list: > http://1t3xt.info/tutorials/keywords/ > ------------------------------------------------------------------------ ------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA). The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer. ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
