Templates are used to automatically add page elements to all pages in a document or section. This is useful for things like header and footer. There are two types of templates that can be applied. These are document wide templates and section wide templates. By default, a page will use both the document and section template if they are set. For information on how to break a document into sections and apply a section template, see the Document Sectioning topic.
DynamicPDF™ Generator v3.0.1 for COM/ActiveX includes two template classes:
-
Template
- The Template class is used to add Page Element to all pages in the section or document.
Even / Odd Template
- The EvenOddTemplate class is used to add different Page Elements to even or odd pages in the section or document.
- The Template class is used to add Page Element to all pages in the section or document.
Document Templates
Document templates are applied by creating a Template class, adding page elements to it, then setting it to the Document's Template property. All page elements within this template will appear in the background of the other contents of the PDF.
[VBScript]
Dim MyTemplate
Set MyTemplate = MyDocument.SetTemplate
MyTemplate.AddLabel "Header", 0, 0, 200, 12
Even / Odd Templates
Even / Odd templates are applied by adding separate elements to both Odd and Even pages. All page elements within the Odd template and Even template will appear in the background on Odd pages and Even pages respectively.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Set MyDocument = Server.CreateObject ( "DynamicPDF.Document" )
Dim MyPageOdd
Dim MyPageEven
Set MyPageOdd = MyDocument.AddPage()
Set MyPageEven = MyDocument.AddPage()
Dim MyTemplate
Set MyTemplate = MyDocument.SetEvenOddTemplate
Dim MyTemplateEvenGroup
Set MyTemplateEvenGroup = MyTemplate.EvenElements
MyTemplateEvenGroup.AddLabel "Even Header", 0, 0, 200, 12
Dim MyTemplateOddGroup
Set MyTemplateOddGroup = MyTemplate.OddElements
MyTemplateOddGroup.AddLabel "Odd Header", 0, 0, 200, 12
MyTemplate.AddLabel "Footer", 0, 680, 200, 12
MyDocument.DrawToWeb true
Set MyPageOdd = Nothing
Set MyPageEven = Nothing
Set MyDocument = Nothing
%>
Stamp Templates
All page elements within this Template will appear in the foreground of the other contents of the PDF.
[VBScript]
Dim MyTemplate
Set MyTemplate = MyDocument.SetStampTemplate
MyTemplate.AddLabel "Header", 0, 0, 200, 12
| See Also |
EvenOddTemplate Class | Template Class | Programming with Generator for COM/ActiveX

