# FormXObject

## Content

# Class: FormXObject

Represents a PDF Form XObject.

## Extends

- [`ObjectBase`](ObjectBase)

## Constructors

### Constructor

```ts
new FormXObject(doc, bounds): FormXObject;
```

Initializes a new instance of the FormXObject class.

#### Parameters

##### doc

[`PdfDocument`](PdfDocument)

The [PdfDocument](PdfDocument) in which the new FormXObject will be used.

##### bounds

[`Rect`](../type-aliases/Rect)

The bounds of the FormXObject.

#### Returns

`FormXObject`

#### Overrides

```ts
ObjectBase.constructor
```

### Constructor

```ts
new FormXObject(doc, page): FormXObject;
```

Initializes a new instance of the FormXObject class using a specified page as the source.

Note that the [FormXObject.matrix](#matrix) and [FormXObject.bounds](#bounds) properties are
automatically adjusted to take into account the [PdfPage](PdfPage) user unit of the source page.

#### Parameters

##### doc

[`PdfDocument`](PdfDocument)

The target [PdfDocument](PdfDocument) where the new FormXObject will be used.

##### page

[`PdfPage`](PdfPage)

The source [PdfPage](PdfPage) the content of which is copied to the FormXObject.
The source page can belong to another document.

#### Returns

`FormXObject`

#### Overrides

```ts
ObjectBase.constructor
```

### Constructor

```ts
new FormXObject(
   om, 
   doc, 
   bounds): FormXObject;
```

Initializes a new instance of the FormXObject class.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the FormXObject object.

##### doc

[`PdfDocument`](PdfDocument)

The [PdfDocument](PdfDocument) in which the new FormXObject will be used.

##### bounds

[`Rect`](../type-aliases/Rect)

The bounds of the FormXObject.

#### Returns

`FormXObject`

#### Overrides

```ts
ObjectBase.constructor
```

### Constructor

```ts
new FormXObject(
   om, 
   doc, 
   page): FormXObject;
```

Initializes a new instance of the FormXObject class using a specified page as the source.

Note that the [FormXObject.matrix](#matrix) and [FormXObject.bounds](#bounds) properties are
automatically adjusted to take into account the [PdfPage](PdfPage) user unit of the source page.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the FormXObject object.

##### doc

[`PdfDocument`](PdfDocument)

The target [PdfDocument](PdfDocument) where the new FormXObject will be used.

##### page

[`PdfPage`](PdfPage)

The source [PdfPage](PdfPage) the content of which is copied to the FormXObject.
The source page can belong to another document.

#### Returns

`FormXObject`

#### Overrides

```ts
ObjectBase.constructor
```

## Accessors

### associatedFiles

#### Get Signature

```ts
get associatedFiles(): AssociatedFiles;
```

Gets the list of embedded files associated with this FormXObject.

##### Returns

[`AssociatedFiles`](AssociatedFiles)

***

### bounds

#### Get Signature

```ts
get bounds(): Rect;
```

Gets the bounds of this FormXObject.

##### Returns

[`Rect`](../type-aliases/Rect)

#### Set Signature

```ts
set bounds(value): void;
```

Sets the bounds of this FormXObject.

##### Parameters

###### value

[`Rect`](../type-aliases/Rect)

##### Returns

`void`

***

### context

#### Get Signature

```ts
get context(): PdfContext;
```

Gets an instance of [PdfContext](PdfContext) that can be used to generate content
of this FormXObject.

##### Returns

[`PdfContext`](PdfContext)

***

### doc

#### Get Signature

```ts
get doc(): PdfDocument;
```

Gets the [PdfDocument](PdfDocument) owning this object.

##### Returns

[`PdfDocument`](PdfDocument)

***

### hasAssociatedFiles

#### Get Signature

```ts
get hasAssociatedFiles(): boolean;
```

Gets a value indicating whether the [FormXObject.associatedFiles](#associatedfiles) collection is not empty.

##### Returns

`boolean`

***

### id

#### Get Signature

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### matrix

#### Get Signature

```ts
get matrix(): number[];
```

Gets the matrix that maps form space into user space.
The matrix consists of six numbers (m11, m12, m21, m22, m31, m32).

##### Returns

`number`[]

#### Set Signature

```ts
set matrix(value): void;
```

Sets the matrix that maps form space into user space.
The matrix consists of six numbers (m11, m12, m21, m22, m31, m32).

##### Parameters

###### value

`number`[]

##### Returns

`void`

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

## Methods

### free()

```ts
free(): void;
```

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### rebind()

```ts
rebind(omTo): void;
```

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)
