Class 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 Detail

      • numbered

        private 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 Phrase after
        This is the Phrase that comes after the pagenumber.
      • alignment

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

        private java.util.List<Element> specialContent
        This is the List containing non-text Element.
      • padding

        private float padding
        This is the padding of height of header/footer.
    • Constructor Detail

      • 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 Detail

      • 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 java.util.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
      • getFont

        private Font getFont()
      • alignment

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