# Javascript: SignatureFieldCollection.addAnchoredAtLocation Method

> Inserts a new signature field which is anchored to the specified text position. It has the specified location relative to the paragraph it is anchored to and a textflow which is given through the insertionMode parameter. Anchored signature fields are moved with the text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 31.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: SignatureFieldCollection.addAnchoredAtLocation Method
- **693 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/signaturefieldcollection/addanchoredatlocation-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/signaturefieldcollection/addanchoredatlocation-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/signaturefieldcollection/addanchoredatlocation-method/llms-full.txt

---

### Description

Inserts a new signature field which is anchored to the specified text position. It has the specified location relative to the paragraph it is anchored to and a textflow which is given through the insertionMode parameter. Anchored signature fields are moved with the text.

### Syntax

```javascript
<void> SignatureFieldCollection.addAnchoredAtLocation(<Size> size, <Point> location, <number> textPosition, <FrameInsertionMode> insertionMode, [<RequestSignatureFieldCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| size | The signature field's size in twips. |
| location | Specifies the location, in twips, at which the signature field is to be inserted. This is a location relative to the top left corner either of a page or of a paragraph. |
| textPosition | Specifies the text position at which the signature field is to be inserted. If -1 is specified, the signature field is inserted at the current input position. |
| insertionMode | Specifies how the text flow is handled. |
| callback | Optional. The newly created signature field object is returned via this callback function. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `SignatureFieldCollection.addAnchoredAtLocation` in a practical document-editing workflow. It inserts a new signature field which is anchored to the specified text position. It has the specified location relative to the paragraph it is anchored to and a textflow which is given through the insertionMode parameter. Anchored signature fields are moved with the text.

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

TXTextControl.signatureFields.addAnchoredAtLocation(
    { width: 2880, height: 1440 },
    { x: 1440, y: 720 },
    -1,
    TXTextControl.FrameInsertionMode.AsCharacter,
    function(signatureField) {
        if (!signatureField) {
            console.warn("No signature field was returned.");
            return;
        }
        
        console.log("add anchored at location result:", signatureField);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: SignatureFieldCollection.addAnchored Method](https://docs.textcontrol.com/ds-server/reference/javascript/signaturefieldcollection/addanchored-method/llms-full.txt)
- **Next:** [Javascript: SignatureFieldCollection.addAtFixedPositionInDocument Method](https://docs.textcontrol.com/ds-server/reference/javascript/signaturefieldcollection/addatfixedpositionindocument-method/llms-full.txt)
