Table of Contents

Class PdfDocumentTemplate

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

Encapsulates a page template for all the pages in the document.

public class PdfDocumentTemplate
Inheritance
PdfDocumentTemplate
Derived
Inherited Members

Examples

//Create a PDF document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
RectangleF rect = new RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
//Creates a new page and adds it as the last page of the document template
PdfPageTemplateElement footer = new PdfPageTemplateElement(rect);
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.Bottom = footer;
//Save the document
doc.Save("Template.pdf");
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = doc.Pages.Add()
Dim rect As RectangleF = New RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
'Create a page template
Dim footer As PdfPageTemplateElement = New PdfPageTemplateElement(rect)
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Gray)
'Create page number field
Dim pageNumber As PdfPageNumberField = New PdfPageNumberField(font, brush)
'Create page count field
Dim count As PdfPageCountField = New PdfPageCountField(font, brush)
Dim compositeField As PdfCompositeField = 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.Bottom = footer
doc.Save("Template.pdf")
'Close the document
doc.Close(True)

Constructors

PdfDocumentTemplate()

Initializes a new instance of the PdfDocumentTemplate class.

public PdfDocumentTemplate()
See Also

Properties

Bottom

Gets or sets a bottom page template.

public PdfPageTemplateElement Bottom { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

EvenBottom

Gets or sets a bottom page template using on the even pages.

public PdfPageTemplateElement EvenBottom { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

EvenLeft

Gets or sets a left page template using on the even pages.

public PdfPageTemplateElement EvenLeft { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

EvenRight

Gets or sets a right page template using on the even pages.

public PdfPageTemplateElement EvenRight { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

EvenTop

Gets or sets a top page template using on the even pages.

public PdfPageTemplateElement EvenTop { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

Left

Gets or sets a left page template.

public PdfPageTemplateElement Left { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

OddBottom

Gets or sets a bottom page template using on the odd pages.

public PdfPageTemplateElement OddBottom { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

OddLeft

Gets or sets a left page template using on the odd pages.

public PdfPageTemplateElement OddLeft { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

OddRight

Gets or sets a right page template using on the odd pages.

public PdfPageTemplateElement OddRight { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

OddTop

Gets or sets a top page template using on the odd pages.

public PdfPageTemplateElement OddTop { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

Right

Gets or sets a right page template.

public PdfPageTemplateElement Right { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

Stamps

Gets a collection of stamp elements.

public PdfStampCollection Stamps { get; }

Property Value

PdfStampCollection

The PdfStampCollection,a collection of stamps that are applied to the page templates.

See Also

Top

Gets or sets a top page template.

public PdfPageTemplateElement Top { get; set; }

Property Value

PdfPageTemplateElement

The PdfPageTemplateElement to draw into the PDF page

See Also

See Also