Group
Represents a group of page elements.
public class Group : PageElement, IEnumerable, IPageElementContainer, ISerializable
Public Class Group
Inherits PageElement
Implements IEnumerable, IPageElementContainer, ISerializable
Inheritance: ObjectPageElementGroup
Implements: IEnumerable, IPageElementContainer, ISerializable
Derived: AnchorGroup, AreaGroup, ContentArea, TransformationGroup, TransparencyGroup
Licensing Info
This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
Examples
The following example will place a rectangle and several lines into a group object and then add that group to the page.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 group
Dim MyGroup As Group = New Group
' Add page elements to the group
MyGroup.Add(New Rectangle(0, 0, 200, 200, 3))
MyGroup.Add(New Line(0, 100, 100, 0, 3))
MyGroup.Add(New Line(100, 0, 200, 100, 3))
MyGroup.Add(New Line(200, 100, 100, 200, 3))
MyGroup.Add(New Line(100, 200, 0, 100, 3))
' Add the 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 group
Group mygroup = new Group();
// Add page elements to the group
mygroup.Add( new Rectangle( 0, 0, 200, 200, 3 ) );
mygroup.Add( new Line( 0, 100, 100, 0, 3 ) );
mygroup.Add( new Line( 100, 0, 200, 100, 3 ) );
mygroup.Add( new Line( 200, 100, 100, 200, 3 ) );
mygroup.Add( new Line( 100, 200, 0, 100, 3 ) );
// Add the group to the page
page.Elements.Add( mygroup );
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to collect many page elements together and add them to the page all at once. Every page element that you add to the group will be added to the page when the group is added to the page.
Constructors
Group() | Initializes a new instance of the Group class. |
Properties
Count | Gets the number of page elements in the group. |
ID | Gets or sets the ID of the page element. (Inherited from PageElement) |
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) |
Item[Int32] | Gets the PageElement object at the given index. |
Item[String] | Gets the PageElement object with the given ID. |
RelativeTo | Gets and sets placement of the page element on the page. (Inherited from PageElement) |
Methods
Add(PageElement) | Adds a page element to the group. |
Draw(PageWriter) | Draws the group to the given PageWriter object. |
Equals(Object) | Determines whether the specified Object is equal to the current Object . (Inherited from Object) |
GetEnumerator() | Returns an enumerator that can iterate through the Group . |
GetHashCode() | Serves as a hash function for a particular type. (Inherited from Object) |
GetPageElementByID(String) | Returns a page element with the given ID. |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
Insert(Int32, PageElement) | Inserts a page element to the group. |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |