Class PdfDestinationPageNumberField
Represents class which displays destination page's number.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfDestinationPageNumberField : PdfPageNumberField
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font);
for (int i = 0; i!=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DateTimeField.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 PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font)
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DateTimeField.pdf")
doc.Close(True)
Constructors
PdfDestinationPageNumberField()
Initializes a new instance of the PdfDestinationPageNumberField class.
Declaration
public PdfDestinationPageNumberField()
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
// Creates page number field
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField();
for (int i = 0; i !=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DestinationPageNumberField.pdf");
doc.Close(true);
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Creates page number field
Dim pageNumber As PdfDestinationPageNumberField = New PdfDestinationPageNumberField()
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.pdf");
doc.Close(True)
PdfDestinationPageNumberField(PdfFont)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont
Declaration
public PdfDestinationPageNumberField(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
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font);
for (int i = 0; i!=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DestinationPageNumberField.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 PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font)
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.pdf");
doc.Close(True)
PdfDestinationPageNumberField(PdfFont, PdfBrush)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont and PdfBrush.
Declaration
public PdfDestinationPageNumberField(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
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font, PdfBrushes.Azure);
for (int i = 0; i!=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DestinationPageNumberField.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 PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font, PdfBrushes.Azure)
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.pdf");
doc.Close(True)
PdfDestinationPageNumberField(PdfFont, RectangleF)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont and rectangle bounds.
Declaration
public PdfDestinationPageNumberField(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. |
System.Drawing.RectangleF | bounds | Specifies the location and size of the field. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font, new RectangleF(10, 10, 100, 200));
for (int i = 0; i!=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DestinationPageNumberField.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 PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font, New RectangleF(10, 10,100,200))
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.pdf");
doc.Close(True)
Properties
LoadedPage
Get and sets the PdfLoadedPage
Declaration
public PdfLoadedPage LoadedPage { get; set; }
Property Value
Type | Description |
---|---|
PdfLoadedPage |
Examples
// Loads an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SrcDocument.pdf");
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font, new RectangleF(10, 10,100,200));
for (int i = 0; i != doc.Pages.Count; i++)
{
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.LoadedPage = doc.Pages[1] as PdfLoadedPage;
pageNumber.Draw(doc.Pages[1].Graphics);
}
}
doc.Save("DestinationPageNumberField.pdf");
doc.Close(true);
' Loads an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SrcDocument.pdf")
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
' Creates page number field
Dim pageNumber As PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font, New RectangleF(10, 10,100,200))
For i As Integer = 0 To doc.Pages.Count - 1
' Draws the page number only on the second page
If i = 1 Then
pageNumber.LoadedPage = TryCast(doc.Pages(1), PdfLoadedPage)
pageNumber.Draw(doc.Pages(1).Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.pdf");
doc.Close(True)
Page
Gets or sets the page.
Declaration
public PdfPage Page { get; set; }
Property Value
Type | Description |
---|---|
PdfPage | The page. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
// Creates page number field
PdfDestinationPageNumberField pageNumber = new PdfDestinationPageNumberField(font);
for (int i = 0; i !=2; i++)
{
PdfPage page = doc.Pages.Add();
// Draws the page number only on the second page
if (i == 1)
{
pageNumber.Page = page;
pageNumber.Draw(page.Graphics);
}
}
doc.Save("DestinationPageNumberField.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 PdfDestinationPageNumberField = New PdfDestinationPageNumberField(font)
For i As Integer = 0 To 1
Dim page As PdfPage = doc.Pages.Add()
' Draws the page number only on the second page
If i = 1 Then
pageNumber.Page = page
pageNumber.Draw(page.Graphics)
End If
Next i
doc.Save("DestinationPageNumberField.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 |