EvenOddTemplate
Represents an even / odd section or document template.
public class EvenOddTemplate : Template
Public Class EvenOddTemplate
Inherits Template
Inheritance: ObjectTemplateEvenOddTemplate
Licensing Info
This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
Examples
This example shows how to create an EvenOddTemplate and add it to the document.Imports System
Imports ceTe.DynamicPDF
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 an even odd template and add elements to it
Dim MyTemplate As EvenOddTemplate = New EvenOddTemplate
MyTemplate.EvenElements.Add(New Label("Even Header", 0, 0, 200, 12))
MyTemplate.OddElements.Add(New Label("Odd 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;
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
This class can be used to define a template that can contain separate information to go on even and odd pages. See the Templates topic for more on Templates.
Constructors
EvenOddTemplate() | Initializes a new instance of the Template class. |
Properties
Elements | Gets the page elements that will be applied by the template to all pages. (Inherited from Template) |
EvenElements | Gets the page elements that will be applied by the template to even pages. |
OddElements | Gets the page elements that will be applied by the template to odd 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) |