Package com.aowagie.text
Class HeaderFooter
java.lang.Object
com.aowagie.text.Rectangle
com.aowagie.text.HeaderFooter
- All Implemented Interfaces:
Element
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final Phrase
This is thePhrase
that comes after the pagenumber.private int
This is alignment of the header/footer.private Phrase
This is thePhrase
that comes before the pagenumber.private final boolean
Does the page contain a pagenumber?private int
This is number of the page.Fields inherited from class com.aowagie.text.Rectangle
border, borderWidth, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury
Fields inherited from interface com.aowagie.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, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
Constructor Summary
ConstructorsConstructorDescriptionHeaderFooter
(Phrase before, boolean numbered) Constructs aHeader
-object with a pagenumber at the end. -
Method Summary
Modifier and TypeMethodDescriptiongetAfter()
Gets the part that comes after the pageNumber.Gets the part that comes before the pageNumber.boolean
Checks if the HeaderFooter contains a page number.Gets theParagraph
that can be used as header or footer.void
setAlignment
(int alignment) Sets the alignment.void
setPageNumber
(int pageN) Sets the page number.Methods inherited from class com.aowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, 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, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString, type
-
Field Details
-
numbered
private final boolean numberedDoes the page contain a pagenumber? -
before
This is thePhrase
that comes before the pagenumber. -
pageN
private int pageNThis is number of the page. -
after
This is thePhrase
that comes after the pagenumber. -
alignment
private int alignmentThis is alignment of the header/footer.
-
-
Constructor Details
-
HeaderFooter
Constructs aHeader
-object with a pagenumber at the end.- Parameters:
before
- thePhrase
before the pagenumbernumbered
-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
Gets the part that comes before the pageNumber.- Returns:
- a 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
Gets theParagraph
that can be used as header or footer.- Returns:
- a
Paragraph
-