public class HeaderFooter extends Object
Represents a header or footer of a page in a Pdf document.
[C#] Pdf pdf = new Pdf(); Section section = new Section(pdf); pdf.Sections.Add(section); HeaderFooter hf1 = new HeaderFooter(section); section.OddHeader = section.EvenHeader = hf1; hf1.IsFirstPageOnly = true; Text text = new Text(hf1); hf1.Paragraphs.Add(text); Segment segment = new Segment(text); text.Segments.Add(segment); segment.Content = "header for first page"; HeaderFooter hf2 = new HeaderFooter(section); section.AdditionalOddHeader = hf2; hf2.IsSubsequentPagesOnly = true; text = new Text(hf2); hf2.Paragraphs.Add(text); segment = new Segment(text); text.Segments.Add(segment); segment.Content = "odd header for subsequent pages"; HeaderFooter hf3 = new HeaderFooter(section); section.AdditionalEvenHeader = hf3; hf3.IsSubsequentPagesOnly = true; text = new Text(hf3); hf3.Paragraphs.Add(text); segment = new Segment(text); text.Segments.Add(segment); segment.Content = "even header for subsequent pages"; for(int i = 1; i <= 6; i++) { Text text1 = new Text(section); text1.IsFirstParagraph = true; section.Paragraphs.Add(text1); Segment segment1 = new Segment(text1); text1.Segments.Add(segment1); segment1.Content = "page " + i.ToString(); } pdf.Save(...); [Visual Basic] Dim pdf As Pdf = New Pdf() Dim section As Section = New Section(pdf) pdf.Sections.Add(section) Dim hf1 As HeaderFooter = New HeaderFooter(section) section.OddHeader = hf1 section.EvenHeader = hf1 hf1.IsFirstPageOnly = True Dim text As Text = New Text(hf1) hf1.Paragraphs.Add(text) Dim segment As Segment = New Segment(text) text.Segments.Add(segment) segment.Content = "header for first page" Dim hf2 As HeaderFooter = New HeaderFooter(section) section.AdditionalOddHeader = hf2 hf2.IsSubsequentPagesOnly = True text = New Text(hf2) hf2.Paragraphs.Add(text) segment = New Segment(text) text.Segments.Add(segment) segment.Content = "odd header for subsequent pages" Dim hf3 As HeaderFooter = New HeaderFooter(section) section.AdditionalEvenHeader = hf3 hf3.IsSubsequentPagesOnly = True text = New Text(hf3) hf3.Paragraphs.Add(text) segment = New Segment(text) text.Segments.Add(segment) segment.Content = "even header for subsequent pages" Dim i As Integer For i = 1 To 6 Step i + 1 Dim text1 As Text = New Text(section) text1.IsFirstParagraph = True section.Paragraphs.Add(text1) Dim segment1 As Segment = New Segment(text1) text1.Segments.Add(segment1) segment1.Content = "page " + i.ToString() Next 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>
Modifier and Type | Field and Description |
---|---|
float |
AdditionalHeight |
boolean |
HasProcessed |
boolean |
IsHeader |
Paragraphs |
ParasBehindText |
Paragraphs |
ParasOverText |
Constructor and Description |
---|
HeaderFooter()
Initializes a new instance of the
HeaderFooter class. |
HeaderFooter(Section section)
Initializes a new instance of the
HeaderFooter class. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone()
Clones a new
HeaderFooter object. |
Object |
completeCloneAll()
Clones a new
HeaderFooter object. |
float |
getDistanceFromEdge()
Gets or sets a float value that indicates the Header or Footer's
distance from the edge of the page.The unit is point.
|
GraphInfo |
getGraphInfo()
Gets or sets a
GraphInfo object that indicates the graph info
of the header or footer. |
MarginInfo |
getMargin()
Gets or sets a
MarginInfo object that indicates the margin
info of the header or footer. |
Paragraphs |
getParagraphs()
Gets or sets a
Paragraphs collection that indicates all
paragraphs in the header or footer. |
TextInfo |
getTextInfo()
Gets or sets a
TextInfo object that indicates the text info
of the header or footer. |
boolean |
isFirstPageOnly()
Gets or sets a bool value that indicates whether the header or footer
be printed on first page only.
|
void |
isFirstPageOnly(boolean value) |
boolean |
isLastPageOnly()
Gets or sets a bool value that indicates whether the header or footer
be printed on last page only.
|
void |
isLastPageOnly(boolean value) |
boolean |
isSubsequentPagesOnly()
Gets or sets a bool value that indicates whether the header or footer
be printed not on first page but on subsequent pages only.
|
void |
isSubsequentPagesOnly(boolean value) |
void |
setDistanceFromEdge(float value) |
void |
setGraphInfo(GraphInfo value) |
void |
setMargin(MarginInfo value) |
void |
setParagraphs(Paragraphs value) |
void |
setTextInfo(TextInfo value) |
public float AdditionalHeight
public Paragraphs ParasBehindText
public Paragraphs ParasOverText
public boolean IsHeader
public boolean HasProcessed
public HeaderFooter()
Initializes a new instance of the HeaderFooter
class.
public HeaderFooter(Section section)
Initializes a new instance of the HeaderFooter
class.
section
- The section object. Section
object.
public TextInfo getTextInfo()
Gets or sets a TextInfo
object that indicates the text info
of the header or footer.
public void setTextInfo(TextInfo value)
public GraphInfo getGraphInfo()
Gets or sets a GraphInfo
object that indicates the graph info
of the header or footer.
public void setGraphInfo(GraphInfo value)
public Paragraphs getParagraphs()
Gets or sets a Paragraphs
collection that indicates all
paragraphs in the header or footer.
public void setParagraphs(Paragraphs value)
public MarginInfo getMargin()
Gets or sets a MarginInfo
object that indicates the margin
info of the header or footer.
public void setMargin(MarginInfo value)
public float getDistanceFromEdge()
Gets or 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".
public void setDistanceFromEdge(float value)
public boolean isFirstPageOnly()
Gets or sets a bool 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.
public void isFirstPageOnly(boolean value)
public boolean isLastPageOnly()
Gets or sets a bool value that indicates whether the header or footer be printed on last page only. The default value is false.
public void isLastPageOnly(boolean value)
public boolean isSubsequentPagesOnly()
Gets or sets a bool 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.
public void isSubsequentPagesOnly(boolean value)
public Object completeClone()
Clones a new HeaderFooter
object. Both format and conent is
cloned.
HeaderFooter
object.public Object completeCloneAll()
Clones a new HeaderFooter
object. all format and conent is
cloned.
HeaderFooter
object.Copyright © 2016 Aspose. All Rights Reserved.