# FieldCollection

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / FieldCollection

# Class: FieldCollection

Represents a collection of [Field](Field) objects.

## Extends

- `PdfCollection`\<[`Field`](Field)\>

## Accessors

### count

#### Get Signature

> **get** **count**(): `number`

Gets the number of items in the collection.

##### Returns

`number`

#### Overrides

`PdfCollection.count`

***

### doc

#### Get Signature

> **get** **doc**(): [`PdfDocument`](PdfDocument)

Gets the [PdfDocument](PdfDocument) object that owns this collection.

##### Returns

[`PdfDocument`](PdfDocument)

***

### field

#### Get Signature

> **get** **field**(): [`Field`](Field) \| `null`

Gets the [Field](Field) object that owns this collection.

##### Returns

[`Field`](Field) \| `null`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

`PdfCollection.id`

***

### last

#### Get Signature

> **get** **last**(): `TItem` \| `null`

Gets last item in the collection.

##### Returns

`TItem` \| `null`

#### Inherited from

`PdfCollection.last`

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

`PdfCollection.om`

## Methods

### add()

> **add**(`item`): `void`

Adds an item to the end of the collection.

#### Parameters

##### item

The item to add.

[`Field`](Field) | [`FieldProperties`](../type-aliases/FieldProperties)

#### Returns

`void`

#### Overrides

`PdfCollection.add`

***

### clear()

> **clear**(): `void`

Clears the collection.

#### Returns

`void`

#### Overrides

`PdfCollection.clear`

***

### contains()

> **contains**(`item`): `boolean`

Determines whether the item is in the collection.

#### Parameters

##### item

[`Field`](Field)

#### Returns

`boolean`

true if the item is in the collection, false otherwise.

#### Overrides

`PdfCollection.contains`

***

### findByName()

> **findByName**(`name`): [`Field`](Field) \| `null`

Searches [Field](Field) with specified name, search is case sensitive.

#### Parameters

##### name

`string`

The field's name.

#### Returns

[`Field`](Field) \| `null`

- Returns found [Field](Field) or null if not found.

***

### free()

> **free**(): `void`

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

#### Returns

`void`

#### Inherited from

`PdfCollection.free`

***

### getAt()

> **getAt**(`index`): [`Field`](Field)

Gets the item with the specified index.

#### Parameters

##### index

`number`

The index of the item.

#### Returns

[`Field`](Field)

#### Overrides

`PdfCollection.getAt`

***

### getByName()

> **getByName**(`name`): [`Field`](Field)

Searches [Field](Field) with specified name, search is case sensitive,
throws an exception if a field not found.

#### Parameters

##### name

`string`

The field's name.

#### Returns

[`Field`](Field)

- Returns found [Field](Field), throws an exception if not found.

***

### insert()

> **insert**(`index`, `item`): `void`

Inserts an item at a specific position in the collection.

#### Parameters

##### index

`number`

The position where the item will be inserted.

##### item

The item to insert.

[`Field`](Field) | [`FieldProperties`](../type-aliases/FieldProperties)

#### Returns

`void`

#### Overrides

`PdfCollection.insert`

***

### rebind()

> **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

`PdfCollection.rebind`

***

### remove()

> **remove**(`item`): `boolean`

Removes the specified item from the collection.

#### Parameters

##### item

[`Field`](Field)

The item to remove.

#### Returns

`boolean`

true if the item was actually removed, false otherwise.

#### Overrides

`PdfCollection.remove`

***

### removeAt()

> **removeAt**(`index`): `void`

Removes the item at specified index.

#### Parameters

##### index

`number`

The index of the item to remove.

#### Returns

`void`

#### Overrides

`PdfCollection.removeAt`

***

### setAt()

> **setAt**(`index`, `item`): `void`

Sets the item at the specified index.

#### Parameters

##### index

`number`

The index of the item, starting from 0.

##### item

[`Field`](Field)

The object to set.

#### Returns

`void`

#### Overrides

`PdfCollection.setAt`
