Class PdfSectionNumberField
Represents an automatic field to display the section number.
Inheritance
System.Object
PdfSectionNumberField
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfSectionNumberField : PdfMultipleNumberValueField
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Create a PDF font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates section number field.
PdfSectionNumberField sectionNumber = new PdfSectionNumberField(font);
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin;
//Draw the section number in each page of a section.
for (int i = 0; i != 2; i++)
{
PdfPage page = section.Pages.Add();
sectionNumber.Draw(page.Graphics);
}
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add the section.
Dim section As PdfSection = document.Sections.Add()
'Create a PDF font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
'Creates section number field.
Dim sectionNumber As New PdfSectionNumberField(font)
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin
'Draw the section number in each page of a section.
For i As Integer = 0 To 1
Dim page As PdfPage = section.Pages.Add()
sectionNumber.Draw(page.Graphics)
Next i
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
Constructors
PdfSectionNumberField()
Initializes a new instance of the PdfSectionNumberField class.
Declaration
public PdfSectionNumberField()
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
// Creates section number field
PdfSectionNumberField sectionNumber = new PdfSectionNumberField();
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i != 2; i++)
{
PdfPage page = doc.Pages.Add();
sectionNumber.Draw(page.Graphics);
}
doc.Save("SectionNumberField.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Creates section number field
Dim sectionNumber As PdfSectionNumberField = New PdfSectionNumberField()
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
sectionNumber.Draw(page.Graphics)
Next i
doc.Save("SectionNumberField.pdf")
See Also
PdfSectionNumberField(PdfFont)
Initializes a new instance of the PdfSectionNumberField class.
Declaration
public PdfSectionNumberField(PdfFont font)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | The font. |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Create a PDF font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates section number field.
PdfSectionNumberField sectionNumber = new PdfSectionNumberField(font);
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin;
//Draw the section number in each page of a section.
for (int i = 0; i != 2; i++)
{
PdfPage page = section.Pages.Add();
sectionNumber.Draw(page.Graphics);
}
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add the section.
Dim section As PdfSection = document.Sections.Add()
'Create a PDF font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
'Creates section number field.
Dim sectionNumber As New PdfSectionNumberField(font)
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin
'Draw the section number in each page of a section.
For i As Integer = 0 To 1
Dim page As PdfPage = section.Pages.Add()
sectionNumber.Draw(page.Graphics)
Next i
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
See Also
PdfSectionNumberField(PdfFont, PdfBrush)
Initializes a new instance of the PdfSectionNumberField class.
Declaration
public PdfSectionNumberField(PdfFont font, PdfBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | The font. |
PdfBrush | brush | The brush. |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Create a PDF font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Create a PDF brush.
PdfBrush brush = new PdfSolidBrush(Color.Red);
//Creates section number field.
PdfSectionNumberField sectionNumber = new PdfSectionNumberField(font, brush);
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin;
//Draw the section number in each page of a section.
for (int i = 0; i != 2; i++)
{
PdfPage page = section.Pages.Add();
sectionNumber.Draw(page.Graphics);
}
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add the section.
Dim section As PdfSection = document.Sections.Add()
'Create a PDF font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
'Create a PDF brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Red)
'Creates section number field.
Dim sectionNumber As PdfSectionNumberField = New PdfSectionNumberField(font, brush)
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin
'Draw the section number in each page of a section.
For i As Integer = 0 To 1
Dim page As PdfPage = section.Pages.Add()
sectionNumber.Draw(page.Graphics)
Next i
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
See Also
PdfSectionNumberField(PdfFont, RectangleF)
Initializes a new instance of the PdfSectionNumberField class.
Declaration
public PdfSectionNumberField(PdfFont font, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | The font. |
System.Drawing.RectangleF | bounds | The bounds. |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Create a PDF font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
RectangleF rect = new RectangleF(10, 10, 30, 10);
//Creates section number field within specified bounds.
PdfSectionNumberField sectionNumber = new PdfSectionNumberField(font, rect);
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin;
//Draw the section number in each page of a section.
for (int i = 0; i != 2; i++)
{
PdfPage page = section.Pages.Add();
sectionNumber.Draw(page.Graphics);
}
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new document.
Dim document As New PdfDocument()
'Add the section.
Dim section As PdfSection = document.Sections.Add()
'Create a PDF font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12.0F)
Dim rect As RectangleF = New RectangleF(10, 10, 30, 10)
'Creates section number field within specified bounds.
Dim sectionNumber As PdfSectionNumberField = New PdfSectionNumberField(font, rect)
sectionNumber.NumberStyle = PdfNumberStyle.UpperLatin
'Draw the section number in each page of a section.
For i As Integer = 0 To 1
Dim page As PdfPage = section.Pages.Add()
sectionNumber.Draw(page.Graphics)
Next i
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
See Also
Methods
GetValue(PdfGraphics)
Gets the value of the field at the specified graphics.
Declaration
protected override string GetValue(PdfGraphics graphics)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The graphics. |
Returns
Type | Description |
---|---|
System.String | The value of the field. |
Overrides
Syncfusion.Pdf.PdfAutomaticField.GetValue(Syncfusion.Pdf.Graphics.PdfGraphics)