Class HeaderFooter

java.lang.Object
org.openpdf.text.Rectangle
org.openpdf.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 - page will be numbered if true
    • HeaderFooter

      public HeaderFooter(boolean numbered, Phrase after)
      Constructs a Header-object with a pagenumber at the beginning.
      Parameters:
      numbered - page will be numbered if true
      after - the Phrase after the pagenumber
    • HeaderFooter

      public HeaderFooter(boolean numbered)
      Constructs a Header-object with only a pagenumber.
      Parameters:
      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
    • getPadding

      public float getPadding()
      Gets padding of height of header/footer.
      Returns:
      the padding of height
    • setPadding

      public void setPadding(float padding)
      Sets padding of height of header/footer.
      Parameters:
      padding - the new padding of height
    • addPadding

      public void addPadding(float augment)
      Increases current padding by adding new value into it
      Parameters:
      augment - the new value
    • addSpecialContent

      public void addSpecialContent(Element element)
      Adds non-text Element into specialContent
      Parameters:
      element - the new non-text Element
    • getSpecialContent

      public List<Element> getSpecialContent()
      Gets specialContent
      Returns:
      specialContent
    • 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