# DocumentLinkCollection Object

> The DocumentLinkCollection contains a collection of document links.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > DocumentLinkCollection Object
- **687 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/llms-full.txt

---

### Description

The DocumentLinkCollection contains a collection of [document links](https://docs.textcontrol.com/ds-server/reference/javascript/documentlink/llms-full.txt).

### Syntax

```javascript
DocumentLinkCollection
```

### Examples

The following example demonstrates `DocumentLinkCollection` in a practical document-editing workflow. The DocumentLinkCollection contains a collection of document links .

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const documentLinks = mainText.documentLinks;
    documentLinks.getItem(
        function(result) {
            if (!result) {
                console.warn("No document link was returned.");
                return;
            }
            
            console.log("get item result:", result);
        },
        onTxError,
        25
    );
}, onTxError);
```

---

## In This Section

- [Javascript: DocumentLinkCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/add-method/llms-full.txt): Adds a new document link to the collection.
- [Javascript: DocumentLinkCollection.clear Method](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/clear-method/llms-full.txt): Removes all document links from the collection.
- [Javascript: DocumentLinkCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/getitem-method/llms-full.txt): Gets the document link at the current text input position or the document link with the specified id.
- [Javascript: DocumentLinkCollection.remove Method](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/remove-method/llms-full.txt): Removes the link from the collection.

---

## Nearby

- **Previous:** [DocumentLinkCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcallback/llms-full.txt)
- **Next:** [Javascript: DocumentLinkCollection.add Method](https://docs.textcontrol.com/ds-server/reference/javascript/documentlinkcollection/add-method/llms-full.txt)
