Package com.lowagie.text
Class HeaderFooter
- java.lang.Object
-
- com.lowagie.text.Rectangle
-
- com.lowagie.text.HeaderFooter
-
- All Implemented Interfaces:
Element
public class HeaderFooter extends Rectangle
AHeaderFooter
-object is aRectangle
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 Summary
Fields Modifier and Type Field Description private Phrase
after
This is thePhrase
that comes after the pagenumber.private int
alignment
This is alignment of the header/footer.private Phrase
before
This is thePhrase
that comes before the pagenumber.private boolean
numbered
Does the page contain a pagenumber?private float
padding
This is the padding of height of header/footer.private int
pageN
This is number of the page.private java.util.List<Element>
specialContent
This is theList
containing non-textElement
.-
Fields inherited from class com.lowagie.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, offsetToTop, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders
-
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
-
Constructor Summary
Constructors Constructor Description HeaderFooter(boolean numbered)
Constructs aHeader
-object with only a pagenumber.HeaderFooter(boolean numbered, Phrase after)
Constructs aHeader
-object with a pagenumber at the beginning.HeaderFooter(Phrase before, boolean numbered)
Constructs aHeader
-object with a pagenumber at the end.HeaderFooter(Phrase before, Phrase after)
Constructs aHeaderFooter
-object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPadding(float augment)
Increases current padding by adding new value into itvoid
addSpecialContent(Element element)
Adds non-textElement
intospecialContent
int
alignment()
Gets the alignment of this HeaderFooter.Phrase
getAfter()
Gets the part that comes after the pageNumber.Phrase
getBefore()
Gets the part that comes before the pageNumber.private Font
getFont()
float
getPadding()
Gets padding of height of header/footer.java.util.List<Element>
getSpecialContent()
GetsspecialContent
boolean
isNumbered()
Checks if the HeaderFooter contains a page number.Paragraph
paragraph()
Gets theParagraph
that can be used as header or footer.void
setAlignment(int alignment)
Sets the alignment.void
setPadding(float padding)
Sets padding of height of header/footer.void
setPageNumber(int pageN)
Sets the page number.-
Methods inherited from class com.lowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRelativeTop, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRelativeTop, setRight, setRotation, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString, type
-
-
-
-
Field Detail
-
numbered
private boolean numbered
Does the page contain a pagenumber?
-
before
private Phrase before
This is thePhrase
that comes before the pagenumber.
-
pageN
private int pageN
This is number of the page.
-
after
private Phrase after
This is thePhrase
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 theList
containing non-textElement
.
-
padding
private float padding
This is the padding of height of header/footer.
-
-
Constructor Detail
-
HeaderFooter
public HeaderFooter(Phrase before, Phrase after)
Constructs aHeaderFooter
-object.- Parameters:
before
- thePhrase
before the pagenumberafter
- thePhrase
before the pagenumber
-
HeaderFooter
public HeaderFooter(Phrase before, boolean numbered)
Constructs aHeader
-object with a pagenumber at the end.- Parameters:
before
- thePhrase
before the pagenumbernumbered
- page will be numbered iftrue
-
HeaderFooter
public HeaderFooter(boolean numbered, Phrase after)
Constructs aHeader
-object with a pagenumber at the beginning.- Parameters:
numbered
- page will be numbered iftrue
after
- thePhrase
after the pagenumber
-
HeaderFooter
public HeaderFooter(boolean numbered)
Constructs aHeader
-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-textElement
intospecialContent
- Parameters:
element
- the new non-textElement
-
getSpecialContent
public java.util.List<Element> getSpecialContent()
GetsspecialContent
- Returns:
specialContent
-
paragraph
public Paragraph paragraph()
Gets theParagraph
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
-
-