Template

Represents a document or section template.

public class Template
Public Class Template

Inheritance: ObjectTemplate

Derived: EvenOddTemplate, HeaderFooterTemplate

Licensing Info

This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to create a template and add it to the document.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
     
Module MyModule
     		
    Sub Main()
     		
        ' Create a PDF Document
        Dim MyDocument As Document = New Document
     		
        ' Add 5 blank pages to the document
        MyDocument.Pages.Add(New Page(PageSize.Letter))
        MyDocument.Pages.Add(New Page(PageSize.Letter))
        MyDocument.Pages.Add(New Page(PageSize.Letter))
        MyDocument.Pages.Add(New Page(PageSize.Letter))
        MyDocument.Pages.Add(New Page(PageSize.Letter))
     		
        ' Create a template and add elements to it
        Dim MyTemplate As Template = New Template
        MyTemplate.Elements.Add(New Label("Header", 0, 0, 200, 12))
        MyTemplate.Elements.Add(New Label("Footer", 0, 680, 200, 12))
     		
        ' Add the template to the document
        MyDocument.Template = MyTemplate
     
        ' Save the PDF document
        MyDocument.Draw("C:\MyDocument.pdf")
     		
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
    public static void CreatePDF(string outputPath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Add 5 blank pages to the document
        document.Pages.Add(new Page(PageSize.Letter));
        document.Pages.Add(new Page(PageSize.Letter));
        document.Pages.Add(new Page(PageSize.Letter));
        document.Pages.Add(new Page(PageSize.Letter));
        document.Pages.Add(new Page(PageSize.Letter));

        // Create a template and add elements to it
        Template template = new Template();
        template.Elements.Add(new Label("Header", 0, 0, 200, 12));
        template.Elements.Add(new Label("Footer", 0, 680, 200, 12));

        // Add the template to the document
        document.Template = template;

        // Save the PDF document
        document.Draw(outputPath);
    }
}

Remarks

See the Templates topic for more on templates.

Constructors

Template()Initializes a new instance of the Template class.

Properties

ElementsGets the page elements that will be applied by the template to all pages.

Methods

Draw(PageWriter)Draws the template's page elements to the given PageWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
HasPageElements(Int32)Returns a value indicating if the template has page elements for the given page.
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF

In this topic