# Group Class

> A set of elements to be used within a PDF document.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class Group : Element
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`Element`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md)

## Description

A set of elements to be used within a PDF document.

A Group represents objects in a content object, but it resides in memory.

Therefore the group has no state and is not represented in any way in a PDF content stream. When used in a Clip, a group is used to associate Text objects into a single clipping object.

**Referenced by:** [`Group`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md)

**Uses types:** [`Clip`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md), [`Content`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Content.md), [`Element`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md), [`ElementCloneFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ElementCloneFlags.md), [`ElementType`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ElementType.md), [`Group`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md), [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md), [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

## Constructors

### Group

```cpp
datalogics_interface::Group::Group()
```

*constructor*

Create a new Group.

### Group

```cpp
datalogics_interface::Group::Group(Content *content)
```

*constructor*

**Parameters**

- `content` ([`Content *`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Content.md))

Create a new Group.

### Group

```cpp
datalogics_interface::Group::Group(Group &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`Group &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md))

### ~Group

```cpp
datalogics_interface::Group::~Group() override
```

*destructor*

## Methods

### clear_content

```cpp
void datalogics_interface::Group::clear_content()
```

**Returns:** `void`

Removes the content from this group.

### clone

```cpp
std::unique_ptr< Element > datalogics_interface::Element::clone(ElementCloneFlags flags) const
```

**Parameters**

- `flags` ([`ElementCloneFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ElementCloneFlags.md))

**Returns:** [`std::unique_ptr< Element >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md)

The copied element.

Makes a copy of the element.

Make a copy of an element to obtain a new element that has a distinct set of attributes.

Note: TextRun objects may not be cloned.

### clone

```cpp
std::unique_ptr< Group > datalogics_interface::Group::clone() const
```

**Returns:** [`std::unique_ptr< Group >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md)

The copied group.

Makes a copy of the group.

Make a copy of an group to obtain a new group that has a distinct set of attributes.

### get_bounding_box

```cpp
Rect datalogics_interface::Element::get_bounding_box() const
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

The bounding box for this element. The coordinates of the bounding box are specified in user space coordinates, relative to the element's Content. Note that user space coordinates correspond to unrotated pages; any rotation specified in the page dictionary is not taken into account.

The bounding box for this element.

The bounding box is a rectangle that is guaranteed to encompass the element, but it is not guaranteed to be the smallest box that could contain the element. For example, if the element is a Path that contains an arc, the bounding box encompasses the bezier control points, and not just the curve itself.

### get_clip

```cpp
std::unique_ptr< Clip > datalogics_interface::Element::get_clip()
```

**Returns:** [`std::unique_ptr< Clip >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md)

The current Clip for this Element, or NULL if no clip is set.

Gets the current Clip for an Element.

### get_content

```cpp
std::unique_ptr< Content > datalogics_interface::Group::get_content() const
```

**Returns:** [`std::unique_ptr< Content >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Content.md)

The Content associated with this Group.

Obtain the content of a Group.

### get_element_type

```cpp
ElementType datalogics_interface::Element::get_element_type() const
```

**Returns:** [`ElementType`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ElementType.md)

Returns the runtime type of this element.

### get_matrix

```cpp
Matrix datalogics_interface::Element::get_matrix() const
```

**Returns:** [`Matrix`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)

The current transformation matrix applied to this element.

The transformation matrix for the element.

### operator=

```cpp
Group & datalogics_interface::Group::operator=(Group &&) noexcept
```

**Parameters**

- (unnamed) ([`Group &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md))

**Returns:** [`Group &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md)

### rotate

```cpp
void datalogics_interface::Element::rotate(double theta)
```

**Parameters**

- `theta` (`double`): The rotation angle in degrees.

**Returns:** `void`

Rotate an element by theta degrees counterclockwise using the matrix [ cos T sin T -sin T cos T 0 0 ].

### scale

```cpp
void datalogics_interface::Element::scale(double sx, double sy)
```

**Parameters**

- `sx` (`double`): The horizontal scale factor.
- `sy` (`double`): The vertical scale factor.

**Returns:** `void`

Scale an element by (sx,sy) units using the matrix [ sx 0 0 sy 0 0 ].

### set_clip

```cpp
void datalogics_interface::Element::set_clip(Clip &clip)
```

**Parameters**

- `clip` ([`Clip &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md)): The clip to set as the current clip for this element, or NULL to remove clipping.

**Returns:** `void`

Sets the current Clip for an Element.

### set_content

```cpp
void datalogics_interface::Group::set_content(const Content &content)
```

**Parameters**

- `content` ([`const Content &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Content.md)): The new Content of the group. Must not be null.

**Returns:** `void`

Set the content of a Group.

### set_matrix

```cpp
void datalogics_interface::Element::set_matrix(const Matrix &matrix)
```

**Parameters**

- `matrix` ([`const Matrix &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Matrix.md)): The transformation matrix for the element.

**Returns:** `void`

Set the transformation matrix for the element.

### translate

```cpp
void datalogics_interface::Element::translate(double tx, double ty)
```

**Parameters**

- `tx` (`double`): The horizontal translation distance in user space units.
- `ty` (`double`): The vertical translation distance in user space units.

**Returns:** `void`

Translate an element by (tx,ty) units using the matrix [ 1 0 0 1 tx ty ].

### try_as

```cpp
T * datalogics_interface::Element::try_as()
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `T *`

Attempt to downcast this element to a derived type. Returns a pointer to the derived type, or nullptr if the type doesn't match.

### try_as

```cpp
const T * datalogics_interface::Element::try_as() const
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `const T *`

Const overload of try_as(). Returns a const pointer, or nullptr.
