Skip to main content

HtmlLayout

Version: 12.0

cete.dynamicpdf.htmllayout

HtmlLayout​

Represents a html layout of the document.

public class HtmlLayout
Public Class HtmlLayout

Inheritance: Object → HtmlLayout

Licensing Info​

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

This example shows simple Header Footer Text being displayed on the document.

Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Html

Module MyModule

Sub Main()
'Create Html layout page info
Dim layoutPage As PageInfo = New PageInfo(PageSize.A4, PageOrientation.Portrait)

'Create Uri
Dim uri As Uri = New Uri(inputHTMLPath)
'Create a Html Layout
Dim html As HtmlLayout = New HtmlLayout(uri, layoutPage)

' Create a header
html.Header.Center.Text = "%%PR%%%%SP%% of %%ST%%"
html.Header.Center.HasPageNumbers = True
html.Header.Center.Width = 200

' Create a footer
html.Footer.Center.Text = "%%PR%%%%SP(A)%% of %%ST(B)%%"
html.Footer.Center.HasPageNumbers = True
html.Footer.Center.Width = 200

'Create a PDF Document
Dim document As Document = html.Layout

' Save the PDF
document.Draw(outputPath)

End Sub
End Module
using System;
using ceTe.DynamicPDF;

public class Example
{
public static void CreatePDF(string inputHTMLPath, string outputPath)
{
//Create Html layout page info
PageInfo layoutPage = new PageInfo(PageSize.A4, PageOrientation.Portrait);

//Create Uri
Uri uri = new Uri(inputHTMLPath);

//Create Html Layout
HtmlLayout html = new HtmlLayout(uri, layoutPage);

// Create a header
html.Header.Center.Text = "%%PR%%%%SP%% of %%ST%%";
html.Header.Center.HasPageNumbers = true;
html.Header.Center.Width = 200;

// Create a footer
html.Footer.Center.Text = "%%PR%%%%SP(A)%% of %%ST(B)%%";
html.Footer.Center.HasPageNumbers = true;
html.Footer.Center.Width = 200;

// Create a PDF Document
Document document = html.Layout();

// Save the PDF
document.Draw(outputPath);
}
}

Remarks​

This class can be used to place html layout on a document.

Constructors​

HtmlLayout(Stream, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(Stream stream, PageInfo pageInfo)
Public Sub New (stream As Stream, pageInfo As PageInfo)

Parameters​

Stream object containing the HTML data for the Html Layout.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HtmlLayout(Stream, Uri, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(Stream stream, Uri baseRef, PageInfo pageInfo)
Public Sub New (stream As Stream, baseRef As Uri, pageInfo As PageInfo)

Parameters​

Stream object containing the HTML data for the Html Layout.

Physical file path of the Html resources.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HtmlLayout(String, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(string text, PageInfo pageInfo)
Public Sub New (text As String, pageInfo As PageInfo)

Parameters​

Html text to display in the Html Layout.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HtmlLayout(String, Uri, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(string text, Uri baseRef, PageInfo pageInfo)
Public Sub New (text As String, baseRef As Uri, pageInfo As PageInfo)

Parameters​

Html text to display in the Html Layout.

Physical file path of the Html resources.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HtmlLayout(Uri, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(Uri uri, PageInfo pageInfo)
Public Sub New (uri As Uri, pageInfo As PageInfo)

Parameters​

Physical Html file path of the Html Layout.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HtmlLayout(Uri, Uri, PageInfo)​

Initializes a new instance of the HtmlLayout class.

public HtmlLayout(Uri uri, Uri baseRef, PageInfo pageInfo)
Public Sub New (uri As Uri, baseRef As Uri, pageInfo As PageInfo)

Parameters​

Physical Html file path of the Html Layout.

Physical file path of the Html resources.

The PageInfo representing the size of the page.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Properties​

BaseRef​

Gets or sets the base ref of the Html Layout.

public Uri BaseRef { get; set; }
Public Property BaseRef As Uri

Property Value​

Uri

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

BottomMargin​

Gets or sets the bottom margin of the Html Layout.

public float BottomMargin { get; set; }
Public Property BottomMargin As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Gets a FooterHtmlLayout object that represents the footer properties.

public FooterHtmlLayout Footer { get; }
Public Property Footer As FooterHtmlLayout

Property Value​

FooterHtmlLayout

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Gets a HeaderHtmlLayout object that represents the the header properties.

public HeaderHtmlLayout Header { get; }
Public Property Header As HeaderHtmlLayout

Property Value​

HeaderHtmlLayout

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

LeftMargin​

Gets or sets the left margin of the Html Layout.

public float LeftMargin { get; set; }
Public Property LeftMargin As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

RightMargin​

Gets or sets the right margin of the Html Layout.

public float RightMargin { get; set; }
Public Property RightMargin As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TopMargin​

Gets or sets the top margin of the Html Layout.

public float TopMargin { get; set; }
Public Property TopMargin As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Methods​

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​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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 .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Layout()​

Gets a Document containing the paginated pages.

public Document Layout()
Function Layout() As Document

Returns​

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

This example shows simple HTML 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 Html Layout
Dim html As HtmlLayout = New HtmlLayout(New Uri(inputHTMLPath), New PageInfo(PageSize.A4, PageOrientation.Portrait))

'Create a PDF Document
Dim document As Document = html.Layout

' Save the PDF
document.Draw(outputPath)

End Sub
End Module
using System;
using ceTe.DynamicPDF;

public class Example
{
public static void CreatePDF(string inputHTMLPath, string outputPath)
{
// Create a Html Layout
HtmlLayout html = new HtmlLayout(new Uri(inputHTMLPath), new PageInfo(PageSize.A4, PageOrientation.Portrait));

// Create a PDF Document
Document document = html.Layout();

// Save the PDF
document.Draw(outputPath);
}
}

Layout(Document)​

Adds the paginated pages to the supplied Document .

public void Layout(Document document)
Sub Layout(document As Document)

Parameters​

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

This example shows simple HTML 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 Html Layout
Dim html As HtmlLayout = New HtmlLayout(New Uri(inputHTMLPath), New PageInfo(PageSize.A4, PageOrientation.Portrait))

'Create a PDF Document
Dim document As Document = New Document

html.Layout(document)

' Save the PDF
document.Draw(outputPath)

End Sub
End Module
using System;
using ceTe.DynamicPDF;

public class Example
{
public static void CreatePDF(string inputHTMLPath, string outputPath)
{
// Create a Html Layout
HtmlLayout html = new HtmlLayout(new Uri(inputHTMLPath), new PageInfo(PageSize.A4, PageOrientation.Portrait));

// Create a PDF Document
Document document = new Document();

html.Layout(document);

// Save the PDF
document.Draw(outputPath);
}
}

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 .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

See Also​

ceTe.DynamicPDF