AreaGroup
Represents a group of page elements with an area.
public class AreaGroup : Group, IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable
Public Class AreaGroup
Inherits Group
Implements IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable
Inheritance: ObjectPageElementGroupAreaGroup
Implements: IArea, ICoordinate, IEnumerable, IPageElementContainer, ISerializable
Licensing Info
This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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 an area group
Dim MyGroup As AreaGroup = New AreaGroup(200, 200)
' 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 an area group
AreaGroup group1 = new AreaGroup(200, 200);
// Add page elements to the group
group1.Add(new Rectangle(0, 0, 200, 200, 3));
group1.Add(new Line(0, 100, 100, 0, 3));
group1.Add(new Line(100, 0, 200, 100, 3));
group1.Add(new Line(200, 100, 100, 200, 3));
group1.Add(new Line(100, 200, 0, 100, 3));
// Add the group to the page
page.Elements.Add(group1);
// 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
AreaGroup(Single, Single) | Initializes a new instance of the AreaGroup class. |
Properties
Count | Gets the number of page elements in the group. (Inherited from Group) |
Height | Gets or sets the height of the area 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. (Inherited from Group) |
Item[String] | Gets the PageElement object with the given ID. (Inherited from Group) |
RelativeTo | Gets and sets placement of the page element on the page. (Inherited from PageElement) |
Width | Gets or sets the width of the area group. |
X | Gets the X coordinate of the area group. |
Y | Gets the Y coordinate of the area group. |
Methods
Add(PageElement) | Adds a page element to the group. (Inherited from Group) |
Draw(PageWriter) | Draws the group to the given PageWriter object. (Inherited from Group) |
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 . (Inherited from Group) |
GetHashCode() | Serves as a hash function for a particular type. (Inherited from Object) |
GetPageElementByID(String) | Returns a page element with the given ID. (Inherited from Group) |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
Insert(Int32, PageElement) | Inserts a page element to the group. (Inherited from Group) |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |