Class PdfDestinationPageNumberField
- Namespace
- Syncfusion.Pdf
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents class which displays destination page's number.
public class PdfDestinationPageNumberField : PdfPageNumberField
- Inheritance
-
PdfDestinationPageNumberField
- Inherited Members
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.
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)
- See Also
PdfDestinationPageNumberField(PdfFont)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont
public PdfDestinationPageNumberField(PdfFont font)
Parameters
font
PdfFontA 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)
- See Also
PdfDestinationPageNumberField(PdfFont, RectangleF)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont and rectangle bounds.
public PdfDestinationPageNumberField(PdfFont font, RectangleF bounds)
Parameters
font
PdfFontA PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.
bounds
RectangleFSpecifies 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)
- See Also
PdfDestinationPageNumberField(PdfFont, PdfBrush)
Initializes a new instance of the PdfDestinationPageNumberField class with PdfFont and PdfBrush.
public PdfDestinationPageNumberField(PdfFont font, PdfBrush brush)
Parameters
font
PdfFontA PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.
brush
PdfBrushA 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)
- See Also
Properties
LoadedPage
Get and sets the PdfLoadedPage
public PdfLoadedPage LoadedPage { get; set; }
Property Value
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)
- See Also
Page
Gets or sets the page.
public PdfPage Page { get; set; }
Property Value
- 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)
- See Also
Methods
GetValue(PdfGraphics)
Gets the value of the field at the specified graphics.
protected override string GetValue(PdfGraphics graphics)
Parameters
graphics
PdfGraphicsThe graphics.
Returns
- See Also