Class HeaderFooter

java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.HeaderFooter
All Implemented Interfaces:
Element

public class HeaderFooter extends Rectangle
A HeaderFooter-object is a Rectangle with text that can be put above and/or below every page.

Example:

 HeaderFooter header = new HeaderFooter(new Phrase("This is a header."), false);
 HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), new Phrase("."));
 document.setHeader(header);
 document.setFooter(footer);
 
  • Constructor Details

    • HeaderFooter

      public HeaderFooter(Phrase before, Phrase after)
      Constructs a HeaderFooter-object.
      Parameters:
      before - the Phrase before the pagenumber
      after - the Phrase before the pagenumber
    • HeaderFooter

      public HeaderFooter(Phrase before, boolean numbered)
      Constructs a Header-object with a pagenumber at the end.
      Parameters:
      before - the Phrase before the pagenumber
      numbered - true if the page has to be numbered
  • Method Details

    • isNumbered

      public boolean isNumbered()
      Checks if the HeaderFooter contains a page number.
      Returns:
      true if the page has to be numbered
    • getBefore

      public Phrase getBefore()
      Gets the part that comes before the pageNumber.
      Returns:
      a Phrase
    • getAfter

      public Phrase getAfter()
      Gets the part that comes after the pageNumber.
      Returns:
      a Phrase
    • setPageNumber

      public void setPageNumber(int pageN)
      Sets the page number.
      Parameters:
      pageN - the new page number
    • setAlignment

      public void setAlignment(int alignment)
      Sets the alignment.
      Parameters:
      alignment - the new alignment
    • paragraph

      public Paragraph paragraph()
      Gets the Paragraph that can be used as header or footer.
      Returns:
      a Paragraph
    • alignment

      public int alignment()
      Gets the alignment of this HeaderFooter.
      Returns:
      alignment