com.lowagie.text

Class HeaderFooter

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 Summary
Phraseafter
This is the Phrase that comes after the pagenumber.
intalignment
This is alignment of the header/footer.
Phrasebefore
This is the Phrase that comes before the pagenumber.
booleannumbered
Does the page contain a pagenumber?
intpageN
This is number of the page.
Constructor Summary
HeaderFooter(Phrase before, Phrase after)
Constructs a HeaderFooter-object.
HeaderFooter(Phrase before, boolean numbered)
Constructs a Header-object with a pagenumber at the end.
Method Summary
intalignment()
Gets the alignment of this HeaderFooter.
PhrasegetAfter()
Gets the part that comes after the pageNumber.
PhrasegetBefore()
Gets the part that comes before the pageNumber.
booleanisNumbered()
Checks if the HeaderFooter contains a page number.
Paragraphparagraph()
Gets the Paragraph that can be used as header or footer.
voidsetAlignment(int alignment)
Sets the alignment.
voidsetPageNumber(int pageN)
Sets the page number.

Field Detail

after

private Phrase after
This is the Phrase that comes after the pagenumber.

alignment

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

before

private Phrase before
This is the Phrase that comes before the pagenumber.

numbered

private boolean numbered
Does the page contain a pagenumber?

pageN

private int pageN
This is number of the page.

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 true if the page has to be numbered

Method Detail

alignment

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

Returns: alignment

getAfter

public Phrase getAfter()
Gets the part that comes after the pageNumber.

Returns: a Phrase

getBefore

public Phrase getBefore()
Gets the part that comes before the pageNumber.

Returns: a Phrase

isNumbered

public boolean isNumbered()
Checks if the HeaderFooter contains a page number.

Returns: true if the page has to be numbered

paragraph

public Paragraph paragraph()
Gets the Paragraph that can be used as header or footer.

Returns: a Paragraph

setAlignment

public void setAlignment(int alignment)
Sets the alignment.

Parameters: alignment the new alignment

setPageNumber

public void setPageNumber(int pageN)
Sets the page number.

Parameters: pageN the new page number