BoundingBox

Represents a bounding box.

public class BoundingBox
Public Class BoundingBox

Inheritance: ObjectBoundingBox

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.
BoundingBox(Single, Single, Single, Single)Initializes a new instance of the BoundingBox class.

Methods

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)
SetBBox(Single, Single, Single, Single)Sets the bounding box.
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF

In this topic