cete.dynamicpdf.pageelements.html.htmlarea
HtmlArea
- Namespace: ceTe.DynamicPDF.PageElements.Html
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a HTML Area page element.
public class HtmlArea : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class HtmlArea
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → RotatingPageElement → HtmlArea
Implements: IArea, ICoordinate, ISerializable
Licensing
This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Professional Edition
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Professional Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
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 PDF Document
Dim MyDocument As Document = New Document()
' Create a uri
Dim MyUri As Uri = New Uri("C:\Temp\TestPage.html")
' Create a html area
Dim MyHtmlArea As HtmlArea = New HtmlArea(MyUri, 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
MyDocument.Draw("MyOutput.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Html;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Uri
Uri filePath = new Uri( @"C:\Temp\TestPage.html");
// 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("output.pdf");
}
}
Remarks
This class can be used to place HTML Area on a page. Visual C++ Redistributables is required for the usage of this class. Refer to the deployment topic for more details.
Constructors
HtmlArea(Stream, Single, Single, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(Stream stream, float x, float y, float width, float height)
Public Sub New (stream As Stream, x As Single, y As Single, width As Single, height As Single)
Parameters
- stream: Stream
Stream object containing the HTML data.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
HtmlArea(Stream, Single, Single, Uri, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(Stream stream, float x, float y, Uri baseHref, float width, float height)
Public Sub New (stream As Stream, x As Single, y As Single, baseHref As Uri, width As Single, height As Single)
Parameters
- stream: Stream
Stream object containing the HTML data.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- baseHref: Uri
Basehref of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
HtmlArea(String, Single, Single, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(string text, float x, float y, float width, float height)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single)
Parameters
- text: String
Text to display in the HTML Area.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
HtmlArea(String, Single, Single, Uri, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(string text, float x, float y, Uri baseHref, float width, float height)
Public Sub New (text As String, x As Single, y As Single, baseHref As Uri, width As Single, height As Single)
Parameters
- text: String
Text to display in the HTML Area.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- baseHref: Uri
Basehref of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
HtmlArea(Uri, Single, Single, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(Uri uri, float x, float y, float width, float height)
Public Sub New (uri As Uri, x As Single, y As Single, width As Single, height As Single)
Parameters
- uri: Uri
Physical file path of the HTML Area.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
HtmlArea(Uri, Single, Single, Uri, Single, Single)
Initializes a new instance of the HtmlArea class.
public HtmlArea(Uri uri, float x, float y, Uri baseHref, float width, float height)
Public Sub New (uri As Uri, x As Single, y As Single, baseHref As Uri, width As Single, height As Single)
Parameters
- uri: Uri
Physical file path of the HTML Area.
- x: Single
X coordinate of the HTML Area.
- y: Single
Y coordinate of the HTML Area.
- baseHref: Uri
Basehref of the HTML Area.
- width: Single
Width of the HTML Area.
- height: Single
Height of the HTML Area.
Properties
Angle
Gets or sets the heights of the angle element. (Inherited from RotatingPageElement)
public float Angle { get; set; }
Public Property Angle As Single
Property Value
Height
Gets or sets the height of the HTML area.
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
Width
Gets or sets the width of the HTML area.
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement)
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement)
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the page element'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 .
GetOverflowHtmlArea()
Returns a new HtmlArea object containing the overflow html area.
public HtmlArea GetOverflowHtmlArea()
Function GetOverflowHtmlArea() As HtmlArea
Returns
A HtmlArea if there is overflow html area; otherwise, null .
Examples
The following example shows you how to use the GetOverflowHtmlArea object.
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 a uri.
Dim MyUri As Uri = New Uri("C:\Temp\TestPage.html")
' Create a html area
Dim MyHtmlArea As HtmlArea = New HtmlArea(MyUri, 0, 0, 500, 600)
Do
' 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)
' Set the html area object equal to the rest of the html area that did not fit
' if all the html area did fit, GetOverflowHtmlArea will return null
MyHtmlArea = MyHtmlArea.GetOverflowHtmlArea(0, 0, 600)
Loop While Not MyHtmlArea Is Nothing
' Save the PDF
MyDocument.Draw("MyOutput.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Html;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Uri
Uri filePath = new Uri(@"C:\Temp\TestPage.html");
// create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
do
{
// Create a new 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);
// Set the html area object equal to the rest of the html area that did not fit
// if all the html area did fit, GetOverflowHtmlArea will return null
htmlArea = htmlArea.GetOverflowHtmlArea(0, 0, 600);
} while (htmlArea != null);
//Save the PDF
document.Draw("output.pdf");
}
}
Remarks
This method returns a new HTML area object that contains the remaining html area that did not fit.
GetOverflowHtmlArea(Single, Single, Single)
Returns a new HtmlArea object containing the overflow html area.
public HtmlArea GetOverflowHtmlArea(float x, float y, float height)
Function GetOverflowHtmlArea(x As Single, y As Single, height As Single) As HtmlArea
Parameters
- x: Single
X coordinate of the new object.
- y: Single
Y coordinate of the new object.
- height: Single
Height of the new object.
Returns
A HtmlArea if there is overflow html area; otherwise, null .
Examples
The following example shows you how to use the GetOverflowHtmlArea object.
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 a uri
Dim MyUri As Uri = New Uri("C:\Temp\TestPage.html")
' Create a html area
Dim MyHtmlArea As HtmlArea = New HtmlArea(MyUri, 0, 0, 500, 600)
Do
' 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)
' Set the html area object equal to the rest of the html area that did not fit
' if all the html area did fit, GetOverflowHtmlArea will return null
MyHtmlArea = MyHtmlArea.GetOverflowHtmlArea(0, 0, 600)
Loop While Not MyHtmlArea Is Nothing
' Save the PDF
MyDocument.Draw("MyOutput.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Html;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Uri
Uri filePath = new Uri(@"C:\Temp\TestPage.html");
// create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
do
{
// Create a new 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);
// Set the html area object equal to the rest of the html area that did not fit
// if all the html area did fit, GetOverflowHtmlArea will return null
htmlArea = htmlArea.GetOverflowHtmlArea(0, 0, 600);
} while (htmlArea != null);
//Save the PDF
document.Draw("output.pdf");
}
}
Remarks
This method returns a new HTML area object that contains the remaining html area that did not fit.
GetRequiredHeight()
Returns the height required to fit html file.
public float GetRequiredHeight()
Function GetRequiredHeight() As Single
Returns
The required height to display html file.
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.
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 .