cete.dynamicpdf.boundingbox
BoundingBox
- Namespace: ceTe.DynamicPDF
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a bounding box.
public class BoundingBox
Public Class BoundingBox
Inheritance: Object → BoundingBox
Examples
The following example shows how to add bounding box to the rectangle.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Specify document as a tagged PDF
MyDocument.Tag = New TagOptions()
' Create a page and add it to the document
Dim MyPage As Page = New Page()
MyDocument.Pages.Add(MyPage)
' Create a rectangle
Dim MyRectangle As Rectangle = New Rectangle(100, 100, 100, 100, RgbColor.Black, RgbColor.Blue)
' Create a structure element
Dim MyStructureElement As StructureElement = New StructureElement(TagType.Figure)
' Create an attribute object
Dim MyAttributeObject As AttributeObject = New AttributeObject(AttributeOwner.Layout)
MyAttributeObject.SetHeight() ' Sets default value to the height attribute
MyAttributeObject.SetWidth() ' Sets default value to the width attribute
' Calculates bounding box and Add it to the bounding box attribute
MyAttributeObject.SetBoundingBox(New BoundingBox(MyPage, MyRectangle.X, MyRectangle.Y, MyRectangle.Width, MyRectangle.Height, MyRectangle.Angle))
' Add attribute object to the structure element
MyStructureElement.AttributeLists.Add(MyAttributeObject)
' Tag the rectangle with the structure element
MyRectangle.Tag = MyStructureElement
' Add rectangle to the page
MyPage.Elements.Add(MyRectangle)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Specify document as a tagged PDF
document.Tag = new TagOptions();
// Create a page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a rectangle
Rectangle rectangle = new Rectangle(100, 100, 100, 100, RgbColor.Black, RgbColor.Blue);
// Create a structure element
StructureElement structureElement = new StructureElement(TagType.Figure);
// Create an attribute object
AttributeObject attributeObject = new AttributeObject(AttributeOwner.Layout);
attributeObject.SetHeight(); // Sets default value to the height attribute
attributeObject.SetWidth(); // Sets default value to the width attribute
// Calculates bounding box and Add it to the bounding box attribute
attributeObject.SetBoundingBox(new BoundingBox(page, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, rectangle.Angle));
// Add attribute object to the structure element
structureElement.AttributeLists.Add(attributeObject);
// Tag the rectangle with the structure element
rectangle.Tag = structureElement;
// Add rectangle to the page
page.Elements.Add(rectangle);
// Save the PDF
document.Draw( outputPath );
}
}
Constructors
BoundingBox(Page, Single, Single, Single, Single, Single)
Initializes a new instance of the BoundingBox class.
public BoundingBox(Page page, float x, float y, float width, float height, float angle)
Public Sub New (page As Page, x As Single, y As Single, width As Single, height As Single, angle As Single)
Parameters
- page: Page
page of the document.
- x: Single
X coordinate of the page element.
- y: Single
Y coordinate of the page element.
- width: Single
width of the page element.
- height: Single
height of the page element.
- angle: Single
angle of the page element.
BoundingBox(Single, Single, Single, Single)
Initializes a new instance of the BoundingBox class.
public BoundingBox(float left, float bottom, float right, float top)
Public Sub New (left As Single, bottom As Single, right As Single, top As Single)
Parameters
- left: Single
The left edge of the bounding box.
- bottom: Single
The bottom edge of the bounding box.
- right: Single
The right edge of the bounding box.
- top: Single
The top edge of the bounding box.
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
- 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.
SetBBox(Single, Single, Single, Single)
Sets the bounding box.
public void SetBBox(float left, float bottom, float right, float top)
Sub SetBBox(left As Single, bottom As Single, right As Single, top As Single)
Parameters
- left: Single
The left edge of the bounding box.
- bottom: Single
The bottom edge of the bounding box.
- right: Single
The right edge of the bounding box.
- top: Single
The top edge of the bounding box.
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 .