Skip to main content

Template

Version: 12.0

cete.dynamicpdf.template

Template​

Represents a document or section template.

public class Template
Public Class Template

Inheritance: Object → Template

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.

public Template()
Public Sub New ()

Licensing Info​

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

Properties​

Elements​

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

public Group Elements { get; }
Public Property Elements As Group

Property Value​

Group

Licensing Info​

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

Methods​

Draw(PageWriter)​

Draws the template's page elements to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the template's output.

Licensing Info​

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

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

Licensing Info​

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

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

Licensing Info​

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

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

Licensing Info​

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

HasPageElements(Int32)​

Returns a value indicating if the template has page elements for the given page.

public bool HasPageElements(int pageNumber)
Function HasPageElements(pageNumber As Integer) As Boolean

Parameters​

Page number to test.

Returns​

A Boolean value indicating if there are page elements.

Licensing Info​

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

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

Licensing Info​

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

See Also​

ceTe.DynamicPDF