Class HeaderFooter

java.lang.Object
com.aowagie.text.Rectangle
com.aowagie.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);
 
  • Field Details

    • numbered

      private final boolean numbered
      Does the page contain a pagenumber?
    • before

      private Phrase before
      This is the Phrase that comes before the pagenumber.
    • pageN

      private int pageN
      This is number of the page.
    • after

      private final Phrase after
      This is the Phrase that comes after the pagenumber.
    • alignment

      private int alignment
      This is alignment of the header/footer.
  • Constructor Details

    • 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