com.lowagie.text
public class: HeaderFooter [javadoc |
source]
java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.HeaderFooter
All Implemented Interfaces:
Element
Direct Known Subclasses:
RtfHeaderFooters, RtfHeaderFooter, RtfHeaderFooter, RtfHeaderFooterGroup
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);
Fields inherited from com.lowagie.text.Rectangle: |
---|
UNDEFINED, TOP, BOTTOM, LEFT, RIGHT, NO_BORDER, BOX, llx, lly, urx, ury, rotation, backgroundColor, border, useVariableBorders, borderWidth, borderWidthLeft, borderWidthRight, borderWidthTop, borderWidthBottom, borderColor, borderColorLeft, borderColorRight, borderColorTop, borderColorBottom |
Constructor: |
public HeaderFooter(Phrase before,
Phrase after) {
super(0, 0, 0, 0);
setBorder(TOP + BOTTOM);
setBorderWidth(1);
numbered = true;
this.before = before;
this.after = after;
}
Constructs a HeaderFooter -object. Parameters:
before - the Phrase before the pagenumber
after - the Phrase before the pagenumber
|
public HeaderFooter(Phrase before,
boolean numbered) {
super(0, 0, 0, 0);
setBorder(TOP + BOTTOM);
setBorderWidth(1);
this.numbered = numbered;
this.before = before;
}
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
|
Methods from 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, 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 |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from com.lowagie.text.HeaderFooter Detail: |
public int alignment() {
return alignment;
}
Gets the alignment of this HeaderFooter. |
public Phrase getAfter() {
return after;
}
Gets the part that comes after the pageNumber. |
public Phrase getBefore() {
return before;
}
Gets the part that comes before the pageNumber. |
public boolean isNumbered() {
return numbered;
}
Checks if the HeaderFooter contains a page number. |
public Paragraph paragraph() {
Paragraph paragraph = new Paragraph(before.getLeading());
paragraph.add(before);
if (numbered) {
paragraph.addSpecial(new Chunk(String.valueOf(pageN), before.getFont()));
}
if (after != null) {
paragraph.addSpecial(after);
}
paragraph.setAlignment(alignment);
return paragraph;
}
Gets the Paragraph that can be used as header or footer. |
public void setAlignment(int alignment) {
this.alignment = alignment;
}
|
public void setPageNumber(int pageN) {
this.pageN = pageN;
}
|