Table of Contents

Class PdfSectionNumberField

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Represents an automatic field to display the section number.

public class PdfSectionNumberField : PdfMultipleNumberValueField
Inheritance
PdfSectionNumberField
Inherited Members

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.

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.

public PdfSectionNumberField(PdfFont font)

Parameters

font PdfFont

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, RectangleF)

Initializes a new instance of the PdfSectionNumberField class.

public PdfSectionNumberField(PdfFont font, RectangleF bounds)

Parameters

font PdfFont

The font.

bounds RectangleF

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

PdfSectionNumberField(PdfFont, PdfBrush)

Initializes a new instance of the PdfSectionNumberField class.

public PdfSectionNumberField(PdfFont font, PdfBrush brush)

Parameters

font PdfFont

The font.

brush PdfBrush

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

Methods

GetValue(PdfGraphics)

Gets the value of the field at the specified graphics.

protected override string GetValue(PdfGraphics graphics)

Parameters

graphics PdfGraphics

The graphics.

Returns

string

The value of the field.

See Also

See Also