Class PdfPageNumberField
Represents PDF document page number field.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.UWP.dll
Syntax
public class PdfPageNumberField : PdfMultipleNumberValueField
Examples
//Create a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font);
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i != 2; i++)
{
PdfPage page = doc.Pages.Add();
pageNumber.Draw(page.Graphics);
}
doc.Save("PageNumberField.pdf");
doc.Close(true);
'Create a new document
Dim doc As PdfDocument = New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates page number field
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField(font)
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
pageNumber.Draw(page.Graphics)
Next i
doc.Save("PageNumberField.pdf")
doc.Close(True)
Constructors
PdfPageNumberField()
Initializes a new instance of the PdfPageNumberField class.
Declaration
public PdfPageNumberField()
Examples
// Create a new document
PdfDocument doc = new PdfDocument();
// Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField();
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i != 2; i++)
{
PdfPage page = doc.Pages.Add();
pageNumber.Draw(page.Graphics);
}
doc.Save("PageNumberField.pdf");
doc.Close(true);
' Create a new document
Dim doc As PdfDocument = New PdfDocument()
' Creates page number field
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField()
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
pageNumber.Draw(page.Graphics)
Next i
doc.Save("PageNumberField.pdf")
doc.Close(True)
PdfPageNumberField(PdfFont)
Initializes a new instance of the PdfPageNumberField class with PdfFont
Declaration
public PdfPageNumberField(PdfFont font)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font);
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i != 2; i++)
{
PdfPage page = doc.Pages.Add();
pageNumber.Draw(page.Graphics);
}
doc.Save("PageNumberField.pdf");
doc.Close(true);
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
' Creates page number field
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField(font)
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
pageNumber.Draw(page.Graphics)
Next i
doc.Save("PageNumberField.pdf")
doc.Close(True)
PdfPageNumberField(PdfFont, PdfBrush)
Initializes a new instance of the PdfPageNumberField class with PdfFont and PdfBrush.
Declaration
public PdfPageNumberField(PdfFont font, PdfBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use. |
PdfBrush | brush | A PdfBrush object that is used to fill the string. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font, PdfBrushes.Beige);
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i!=2; i++)
{
PdfPage page = doc.Pages.Add();
pageNumber.Draw(page.Graphics);
}
doc.Save("PageNumberField.pdf");
doc.Close(true);
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
' Creates page number field
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField(font, PdfBrushes.Beige)
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
pageNumber.Draw(page.Graphics)
Next i
doc.Save("PageNumberField.pdf")
doc.Close(True)
PdfPageNumberField(PdfFont, RectangleF)
Initializes a new instance of the PdfPageNumberField class with PdfFont and rectangle bounds.
Declaration
public PdfPageNumberField(PdfFont font, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.s |
System.Drawing.RectangleF | bounds | The bounds. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font, new RectangleF(10, 10, 100, 200));
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin;
for (int i = 0; i != 2; i++)
{
PdfPage page = doc.Pages.Add();
pageNumber.Draw(page.Graphics);
}
doc.Save("PageNumberField.pdf");
doc.Close(true);
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
' Creates page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font, new RectangleF(10, 10, 100, 200));
pageNumber.NumberStyle = PdfNumberStyle.UpperLatin
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
pageNumber.Draw(page.Graphics)
Next i
doc.Save("PageNumberField.pdf")
doc.Close(True)
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 | result |