HeaderFooterTemplate
Represents a Header Footer Template of the page element.
public class HeaderFooterTemplate : Template
Public Class HeaderFooterTemplate
Inherits Template
Inheritance: ObjectTemplateHeaderFooterTemplate
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 simple Header Footer Text being displayed on the page.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Html
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create Header Footer Template
Dim MyHeader As HeaderFooterTemplate = New HeaderFooterTemplate("HeaderText", "FooterText")
document.Template = MyHeader
' Create a Uri
Dim MyFilePath As Uri = New Uri("C:\Temp\TestPage.html")
' Create a html area
Dim MyHtmlArea As HtmlArea = New HtmlArea(MyFilePath, 0, 0, 500, 600)
'Create a page
Dim MyPage As Page = New Page()
' Add the html area to the page
MyPage.Elements.Add(MyHtmlArea)
' Add the page to the document
MyDocument.Pages.Add(MyPage)
' Save the PDF document
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.Html;
public class Example
{
public static void CreatePDF(string inputHtmlPath, string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create Header Footer Template
HeaderFooterTemplate header = new HeaderFooterTemplate("HeaderText", "FooterText");
document.Template = header;
// Create a Uri
Uri filePath = new Uri( inputHtmlPath );
// Create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
//Create a page
Page page = new Page();
// Add the html area to the page;
page.Elements.Add(htmlArea);
// Add the page to the document
document.Pages.Add(page);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place Header Footer Template on a page.
Constructors
HeaderFooterTemplate() | Initializes a new instance of the HeaderFooterTemplate class. |
HeaderFooterTemplate(String) | Initializes a new instance of the HeaderFooterTemplate class. |
HeaderFooterTemplate(String, String) | Initializes a new instance of the HeaderFooterTemplate class. |
HeaderFooterTemplate(String, String, Font, Single) | Initializes a new instance of the HeaderFooterTemplate class. |
Properties
Elements | Gets the page elements that will be applied by the template to all pages. (Inherited from Template) |
FooterCenter | Gets or sets the center footer text for the page. |
FooterLeft | Gets or sets the left footer text for the page. |
FooterRight | Gets or sets the right footer text for the page. |
HeaderCenter | Gets or sets the center header footer text for the page. |
HeaderLeft | Gets or sets the left header text for the page. |
HeaderRight | Gets or sets the right header text for the page. |
Methods
Draw(PageWriter) | Draws the header footer 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. (Inherited from Template) |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |