Skip to main content

TransformationGroup

Version: 11.0

cete.dynamicpdf.pageelements.transformationgroup

TransformationGroup​

Represents a group of page elements to transform.

public class TransformationGroup : Group, IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable
Public Class TransformationGroup
Inherits Group
Implements IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable

Inheritance: Object → PageElement → Group → TransformationGroup

Implements: IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable

Examples​

The following example will display an image and some text that has been rotated and horizontally scaled as a group.

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

Module MyModule

Sub Main()

' Create a PDF Document
Dim MyDocument As Document = New Document()

' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)

' Create a transformation group and add a rectangle and a label to it
Dim MyGroup As TransformationGroup = New TransformationGroup(100, 100,200, 200, 30)
MyGroup.Add(New Rectangle(0, 0, 75, 75, RgbColor.Blue, RgbColor.Blue))
MyGroup.Add(New Label("This text is inside a TransformationGroup.", 0,100, 300, 12))

' Vertically scale the group
MyGroup.ScaleY = 2

' Add the transformation group to the page
MyPage.Elements.Add(MyGroup)

' 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();

// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);

// Create a transformation group and add a rectangle and label to it
TransformationGroup group1 = new TransformationGroup(100, 100, 200, 200, 30);
group1.Add(new Rectangle(0, 0, 75, 75, RgbColor.Blue, RgbColor.Blue));
group1.Add(new Label("This text is inside a TransformationGroup.", 0, 100, 300, 12));

// Vertically scale the group
group1.ScaleY = 2;

// Add the transformation group to the page
page.Elements.Add(group1);

document.Draw(outputPath);
}
}

Remarks​

This class can be used to transform entire groups of page elements. Any page element that is placed in this group will be displayed with the transformation values and attributes of this group.

Constructors​

TransformationGroup(Single, Single, Single, Single)​

Initializes a new instance of the TransformationGroup class.

public TransformationGroup(float x, float y, float width, float height)
Public Sub New (x As Single, y As Single, width As Single, height As Single)

Parameters​

X coordinate of the transformation group.

Y coordinate of the transformation group.

Width of the transformation group.

Height of the transformation group.

TransformationGroup(Single, Single, Single, Single, Single)​

Initializes a new instance of the TransformationGroup class.

public TransformationGroup(float x, float y, float width, float height, float angle)
Public Sub New (x As Single, y As Single, width As Single, height As Single, angle As Single)

Parameters​

X coordinate of the transformation group.

Y coordinate of the transformation group.

Width of the transformation group.

Height of the transformation group.

Angle of the transformation group in degrees.

Properties​

Angle​

Gets or sets the Angle of the transformation group.

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

Property Value​

Single

Count​

Gets the number of page elements in the group. (Inherited from Group)

public int Count { get; }
Public Property Count As Int32

Property Value​

Int32

Height​

Gets or sets the height of the transformation group.

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

Property Value​

Single

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​

String

IgnoreMargins​

Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)

public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean

Property Value​

Boolean

Examples​

The following example will place the Label in the top-left of the page with IgnoreMargin

using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();

// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);

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

Item[Int32]​

Gets the PageElement object at the given index. (Inherited from Group)

public PageElement this[int index] { get; }
Public Property Item(index As Integer) As PageElement

Property Value​

PageElement

Item[String]​

Gets the PageElement object with the given ID. (Inherited from Group)

public PageElement this[string id] { get; }
Public Property Item(id As String) As PageElement

Property Value​

PageElement

RelativeTo​

Gets and sets placement of the page element on the page. (Inherited from PageElement)

public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo

Property Value​

RelativeTo

Examples​

The following example will place the Label in the top-left of the page.

using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();

// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);

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

ScaleX​

Gets or sets the X scale of the transformation group.

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

Property Value​

Single

ScaleY​

Gets or sets the Y scale of the transformation group.

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

Property Value​

Single

Width​

Gets or sets the width of the transformation group.

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

Property Value​

Single

X​

Gets or sets the X coordinate of the transformation group.

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

Property Value​

Single

Y​

Gets or sets the Y coordinate of the transformation group.

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

Property Value​

Single

Methods​

Add(PageElement)​

Adds a page element to the group. (Inherited from Group)

public void Add(PageElement pageElement)
Sub Add(pageElement As PageElement)

Parameters​

PageElement object to add to the group.

Draw(PageWriter)​

Draws the transformation group to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the transformation group'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​

The Object to compare with the current Object .

Returns​

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

GetEnumerator()​

Returns an enumerator that can iterate through the Group . (Inherited from Group)

public IEnumerator GetEnumerator()
Function GetEnumerator() As IEnumerator

Returns​

An IEnumerator for the entire Group

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 .

GetPageElementByID(String)​

Returns a page element with the given ID. (Inherited from Group)

public PageElement GetPageElementByID(string id)
Function GetPageElementByID(id As String) As PageElement

Parameters​

ID of the page element to find.

Returns​

PageElement with the given ID.

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.

Insert(Int32, PageElement)​

Inserts a page element to the group. (Inherited from Group)

public void Insert(int index, PageElement pageElement)
Sub Insert(index As Integer, pageElement As PageElement)

Parameters​

The Zero-based index it which the page element should be inserted.

PageElement object to insert in the group.

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 .

See Also​

ceTe.DynamicPDF.PageElements