Document.Template Property
Gets or sets a Template object for the Document . All page elements within this Template will appear in the background of the other contents of the PDF.
public Template Template { get; set; }
Public Property Template As Template
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
This example shows how to create an EvenOddTemplate and Add it to the document.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Html
Module MyModule
Sub Main()
'Create a PDF Document
Dim document As 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 an even odd template and add elements to it
Dim template As EvenOddTemplate = New EvenOddTemplate
template.EvenElements.Add(New Label("Even Header", 0, 0, 200, 12))
template.OddElements.Add(New Label("Odd 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)
End Sub
End Module
using System;
using ceTe.DynamicPDF;
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 an even odd template and add elements to it
EvenOddTemplate template = new EvenOddTemplate();
template.EvenElements.Add(new Label("Even Header", 0, 0, 200, 12));
template.OddElements.Add(new Label("Odd 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.