cete.dynamicpdf.evenoddtemplate
EvenOddTemplate
- Namespace: ceTe.DynamicPDF
- Assemblies: ceTe.DynamicPDF.40.dll
Represents an even / odd section or document template.
public class EvenOddTemplate : Template
Public Class EvenOddTemplate
Inherits Template
Inheritance: Object → Template → EvenOddTemplate
Licensing
This class is a DynamicPDF Generator Community Edition feature.
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;
class MyClass
{static void Main(){ // 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( @"C:\MyDocument.pdf" );}
}
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.
public EvenOddTemplate()
Public Sub New ()
Properties
Elements
Gets the page elements that will be applied by the template to all pages. (Inherited from Template)
public Group Elements { get; }
Public Property Elements As Group
Property Value
EvenElements
Gets the page elements that will be applied by the template to even pages.
public Group EvenElements { get; }
Public Property EvenElements As Group
Property Value
OddElements
Gets the page elements that will be applied by the template to odd pages.
public Group OddElements { get; }
Public Property OddElements As Group
Property Value
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
- writer: PageWriter
PageWriter object to receive the template's output.
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
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
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 .
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.
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
- pageNumber: Int32
The page number to check.
Returns
A Boolean value indicating if there are page elements.
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 .