aspose.pdf
Class HeaderFooter

java.lang.Object
  extended by aspose.pdf.HeaderFooter

public class HeaderFooter
extends java.lang.Object

Represents a header or footer of a page in a Pdf document.

Typical usages are the following:

[Java] Pdf pdf = new Pdf(); Section section = new Section(pdf); pdf.getSections().add(section); HeaderFooter hf1 = new HeaderFooter(section); section.setOddHeader(hf1); section.setEvenHeader(hf1); hf1.setIsFirstPageOnly(true); Text text = new Text(hf1); hf1.getParagraphs().add(text); Segment segment = new Segment(text); text.getSegments().add(segment); segment.setContent("header for first page"); HeaderFooter hf2 = new HeaderFooter(section); section.setAdditionalOddHeader(hf2); hf2.setIsSubsequentPagesOnly(true); text = new Text(hf2); hf2.getParagraphs().add(text); segment = new Segment(text); text.getSegments().add(segment); segment.setContent("odd header for subsequent pages"); HeaderFooter hf3 = new HeaderFooter(section); section.setAdditionalEvenHeader(hf3); hf3.setIsSubsequentPagesOnly(true); text = new Text(hf3); hf3.getParagraphs().add(text); segment = new Segment(text); text.getSegments().add(segment); segment.setContent("even header for subsequent pages"); for(int i = 1; i <= 6; i++) { Text text1 = new Text(section); text1.setIsFirstParagraph(true); section.getParagraphs().add(text1); Segment segment1 = new Segment(text1); text1.getSegments().add(segment1); segment1.setContent("page " + Integer.toString(i)); } pdf.save(...); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section > <Header IsFirstPageOnly="true"> <Text> <Segment>header for first page</Segment> </Text> </Header> <Header Type="odd" IsSubsequentPagesOnly="true"> <Text> <Segment>odd header for subsequent pages</Segment> </Text> </Header> <Header Type="even" IsSubsequentPagesOnly="true"> <Text> <Segment>even header for subsequent pages</Segment> </Text> </Header> <Text IsFirstParagraph="true"> <Segment>page1</Segment> </Text> <Text IsFirstParagraph="true"> <Segment>page2</Segment> </Text> <Text IsFirstParagraph="true"> <Segment>page3</Segment> </Text> <Text IsFirstParagraph="true"> <Segment>page4</Segment> </Text> <Text IsFirstParagraph="true"> <Segment>page5</Segment> </Text> <Text IsFirstParagraph="true"> <Segment>page6</Segment> </Text> </Section> </Pdf>


Field Summary
 boolean hasProcessedForRS
           
 Paragraphs ParasBehindText
          define paragraphs behind text
 Paragraphs ParasOverText
          define paragraphs over text
 
Constructor Summary
HeaderFooter()
          Constructor - initializes a new instance of the HeaderFooter class.
HeaderFooter(Section section)
          Constructor - initializes a new instance of the HeaderFooter class.
 
Method Summary
 java.lang.Object completeClone()
          Clones a new HeaderFooter object.
 java.lang.Object completeCloneAll()
          Clones a new HeaderFooter object.
 float getAdditionalHeight()
          Get the additional height of the header or footer , If the height of more than headerfooter page margin, an increase of this AdditionalHeight
 float getDistanceFromEdge()
          Gets a float value that indicates the Header or Footer's distance from the edge of the page.
 GraphInfo getGraphInfo()
          Gets a GraphInfo object that indicates the graph info of the header or footer.
 boolean getHasProcessed()
          Gets a boolean value that indicates whether the header or footer has been processed.
 boolean getIsHeader()
          Gets a boolean value that indicates whether this object is Header.
 MarginInfo getMargin()
          Gets a MarginInfo object that indicates the margin info of the header or footer.
 Paragraphs getParagraphs()
          Gets a Paragraphs collection that indicates all paragraphs in the header or footer.
 TextInfo getTextInfo()
          Gets a TextInfo object that indicates the text info of the header or footer.
 boolean isFirstPageOnly()
          Gets a boolean value that indicates whether the header or footer be printed on first page only.
 boolean isLastPageOnly()
          Gets a boolean value that indicates whether the header or footer be printed on last page only.
 boolean isSubsequentPagesOnly()
          Gets a boolean value that indicates whether the header or footer be printed not on first page but on subsequent pages only.
 void setAdditionalHeight(float additionalHeight)
          Set the additional height of the header or footer , If the height of more than headerfooter page margin, an increase of this AdditionalHeight
 void setDistanceFromEdge(float fromEdges)
          Sets a float value that indicates the Header or Footer's distance from the edge of the page.
 void setGraphInfo(GraphInfo graphInfo)
          Sets a GraphInfo object that indicates the graph info of the header or footer.
 void setHasProcessed(boolean hasProcessed)
          Sets a boolean value that indicates whether the header or footer has been processed.
 void setIsFirstPageOnly(boolean firstPageOnly)
          Sets a boolean value that indicates whether the header or footer be printed on first page only.
 void setIsHeader(boolean isHeader)
          Sets a boolean value that indicates whether this object is Header.
 void setIsLastPageOnly(boolean lastPageOnly)
          Sets a boolean value that indicates whether the header or footer be printed on last page only.
 void setIsSubsequentPagesOnly(boolean subsequentPagesOnly)
          Sets a boolean value that indicates whether the header or footer be printed not on first page but on subsequent pages only.
 void setMargin(MarginInfo headerFooterMargin)
          Sets a MarginInfo object that indicates the margin info of the header or footer.
 void setParagraphs(Paragraphs paras)
          Sets a Paragraphs collection that indicates all paragraphs in the header or footer.
 void setTextInfo(TextInfo hfTextInfo)
          Sets a TextInfo object that indicates the text info of the header or footer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ParasBehindText

public Paragraphs ParasBehindText
define paragraphs behind text


ParasOverText

public Paragraphs ParasOverText
define paragraphs over text


hasProcessedForRS

public boolean hasProcessedForRS
Constructor Detail

HeaderFooter

public HeaderFooter()
Constructor - initializes a new instance of the HeaderFooter class.


HeaderFooter

public HeaderFooter(Section section)
Constructor - initializes a new instance of the HeaderFooter class.

Parameters:
section - The section object.
Method Detail

getAdditionalHeight

public float getAdditionalHeight()
Get the additional height of the header or footer , If the height of more than headerfooter page margin, an increase of this AdditionalHeight


setAdditionalHeight

public void setAdditionalHeight(float additionalHeight)
Set the additional height of the header or footer , If the height of more than headerfooter page margin, an increase of this AdditionalHeight

Parameters:
additionalHeight -

getTextInfo

public TextInfo getTextInfo()
Gets a TextInfo object that indicates the text info of the header or footer.

Returns:
A TextInfo object.

setTextInfo

public void setTextInfo(TextInfo hfTextInfo)
Sets a TextInfo object that indicates the text info of the header or footer.

Parameters:
hfTextInfo - A TextInfo object.

getGraphInfo

public GraphInfo getGraphInfo()
Gets a GraphInfo object that indicates the graph info of the header or footer.

Returns:
A GraphInfo object.

setGraphInfo

public void setGraphInfo(GraphInfo graphInfo)
Sets a GraphInfo object that indicates the graph info of the header or footer.

Parameters:
graphInfo - A GraphInfo object.

getParagraphs

public Paragraphs getParagraphs()
Gets a Paragraphs collection that indicates all paragraphs in the header or footer.

Returns:
A Paragraphs object.

setParagraphs

public void setParagraphs(Paragraphs paras)
Sets a Paragraphs collection that indicates all paragraphs in the header or footer.

Parameters:
paras - A Paragraphs object.

getMargin

public MarginInfo getMargin()
Gets a MarginInfo object that indicates the margin info of the header or footer.

Returns:
A MarginInfo object.

setMargin

public void setMargin(MarginInfo headerFooterMargin)
Sets a MarginInfo object that indicates the margin info of the header or footer.

Parameters:
headerFooterMargin - A MarginInfo object.

getDistanceFromEdge

public float getDistanceFromEdge()
Gets a float value that indicates the Header or Footer's distance from the edge of the page.

Returns:
A float value.

setDistanceFromEdge

public void setDistanceFromEdge(float fromEdges)
Sets a float value that indicates the Header or Footer's distance from the edge of the page. The unit is point. In XML,the default unit is point,but cm and inch are also supported. For example,"10cm" or "5inch".

Parameters:
fromEdges - A float value.

isFirstPageOnly

public boolean isFirstPageOnly()
Gets a boolean value that indicates whether the header or footer be printed on first page only.

Returns:
A boolean value.

setIsFirstPageOnly

public void setIsFirstPageOnly(boolean firstPageOnly)
Sets a boolean value that indicates whether the header or footer be printed on first page only. The default value is false. If this property is set to true, the IsSubsequentPagesOnly should be false.

Parameters:
firstPageOnly - A boolean value.

isLastPageOnly

public boolean isLastPageOnly()
Gets a boolean value that indicates whether the header or footer be printed on last page only. The default value is false.

Returns:
A boolean value.

setIsLastPageOnly

public void setIsLastPageOnly(boolean lastPageOnly)
Sets a boolean value that indicates whether the header or footer be printed on last page only. The default value is false.

Parameters:
lastPageOnly - A boolean value.

isSubsequentPagesOnly

public boolean isSubsequentPagesOnly()
Gets a boolean value that indicates whether the header or footer be printed not on first page but on subsequent pages only.

Returns:
A boolean value.

setIsSubsequentPagesOnly

public void setIsSubsequentPagesOnly(boolean subsequentPagesOnly)
Sets a boolean value that indicates whether the header or footer be printed not on first page but on subsequent pages only. The default value is false. If this property is set to true, the IsFirstPageOnly should be false.

Parameters:
subsequentPagesOnly - A boolean value.

getIsHeader

public boolean getIsHeader()
Gets a boolean value that indicates whether this object is Header.

Returns:
A boolean value.

setIsHeader

public void setIsHeader(boolean isHeader)
Sets a boolean value that indicates whether this object is Header.

Parameters:
isHeader - A boolean value.

getHasProcessed

public boolean getHasProcessed()
Gets a boolean value that indicates whether the header or footer has been processed.

Returns:
A boolean value.

setHasProcessed

public void setHasProcessed(boolean hasProcessed)
Sets a boolean value that indicates whether the header or footer has been processed.

Parameters:
hasProcessed - A boolean value.

completeClone

public java.lang.Object completeClone()
Clones a new HeaderFooter object. Both format and content is cloned.

Returns:
The new cloned HeaderFooter object.

completeCloneAll

public java.lang.Object completeCloneAll()
Clones a new HeaderFooter object. All format and content is cloned.

Returns:
The new cloned HeaderFooter object.