Class PdfDockStyle
Specifies the docking style of the page template.
Inheritance
System.Object
PdfDockStyle
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public sealed class PdfDockStyle : Enum
Remarks
This enumeration is used in PdfPageTemplateElement class. To know more details about PdfPageTemplateElement refer this link.
Examples
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Create a page
PdfPage page = doc.Pages.Add();
RectangleF rect = new RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
//Create a page template
PdfPageTemplateElement footer = new PdfPageTemplateElement(rect);
//set the dock style
footer.Dock = PdfDockStyle.Right;
//Set the template alignment as top right
footer.Alignment = PdfAlignmentStyle.TopRight;
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 8);
PdfSolidBrush brush = new PdfSolidBrush(Color.Gray);
//Create page number field
PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);
//Create page count field
PdfPageCountField count = new PdfPageCountField(font, brush);
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);
compositeField.Bounds = footer.Bounds;
compositeField.Draw(footer.Graphics, new PointF(40, footer.Height - 50));
//Add the footer template at the bottom
doc.Template.Right = footer;
//Save the document
doc.Save("Template.pdf");
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As New PdfDocument()
'Create a page
Dim page As PdfPage = doc.Pages.Add()
Dim rect As New RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
'Create a page template
Dim footer As New PdfPageTemplateElement(rect)
'set the dock style
footer.Dock = PdfDockStyle.Right
'Set the template alignment as top right
footer.Alignment = PdfAlignmentStyle.TopRight
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
Dim brush As New PdfSolidBrush(Color.Gray)
'Create page number field
Dim pageNumber As New PdfPageNumberField(font, brush)
'Create page count field
Dim count As New PdfPageCountField(font, brush)
Dim compositeField As New PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count)
compositeField.Bounds = footer.Bounds
compositeField.Draw(footer.Graphics, New PointF(40, footer.Height - 50))
'Add the footer template at the bottom
doc.Template.Right = footer
'Save the document
doc.Save("Template.pdf")
'Close the document
doc.Close(True)
Fields
Bottom
The page template edge is docked to the bottom page's side.
Declaration
public const PdfDockStyle Bottom
Field Value
Type |
---|
PdfDockStyle |
Fill
The page template stretch on full page.
Declaration
public const PdfDockStyle Fill
Field Value
Type |
---|
PdfDockStyle |
Left
The page template edge is docked to the left page's side.
Declaration
public const PdfDockStyle Left
Field Value
Type |
---|
PdfDockStyle |
None
The page template is not docked.
Declaration
public const PdfDockStyle None
Field Value
Type |
---|
PdfDockStyle |
Right
The page template edge is docked to the right page's side.
Declaration
public const PdfDockStyle Right
Field Value
Type |
---|
PdfDockStyle |
Top
The page template edge is docked to the top page's side.
Declaration
public const PdfDockStyle Top
Field Value
Type |
---|
PdfDockStyle |