I am using PdfPageEventHelper to add header to my pdf. I would like to add a multi-line header. I know that I can use ColumnText.showTextAligned to add a single line, and theoretically speaking I can take a string, wrap it using the width of the header and then add lines individually. This approach does not move the contents of the page and the header overlaps the text on the page. Is there a way to add a header that will wrap and move the content down?
Using document.add(myPhrase) in onStartPage event does move the content down and wraps header text properly, but sometimes it is inserted on pages where it should not be inserted (for example at the开发者_StackOverflow中文版 bottom of the very last page).
What is the proper way to address this issue?
I have "iText in Action" second edition, but I could not find a proper example there.
Thanks.
I found a partial answer to my question at this thread. I also used a note in "iText in Action" second edition on pg. 79 to find out how much space my header occupied and used this information to change the top margin of the pages.
精彩评论