# Javascript: TextFrameCollection.addAtFixedPositionInDocument Method

> Creates and inserts a new text frame which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TextFrameCollection.addAtFixedPositionInDocument Method
- **627 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframecollection/addatfixedpositionindocument-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframecollection/addatfixedpositionindocument-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframecollection/addatfixedpositionindocument-method/llms-full.txt

---

### Description

Creates and inserts a new text frame which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

### Syntax

```javascript
<void> TextFrameCollection.addAtFixedPositionInDocument(<Size> size, <Point> location, <TextFrameInsertionMode> insertionMode, [<RequestTextFrameCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| size | The text frame's size in twips. |
| location | Specifies the location, in twips, at which the text frame is to be inserted. This is a location relative to the top left corner of the complete document. All gaps between the pages must be included. |
| insertionMode | Specifies how the text flow is handled. |
| callback | Optional. The newly created text frame object is returned via this callback function. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TextFrameCollection.addAtFixedPositionInDocument` in a practical document-editing workflow. It creates and inserts a new text frame which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

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

TXTextControl.textFrames.addAtFixedPositionInDocument(
    { width: 2880, height: 1440 },
    { x: 1440, y: 720 },
    TXTextControl.TextFrameInsertionMode.AsCharacter,
    function(textFrame) {
        if (!textFrame) {
            console.warn("No text frame was returned.");
            return;
        }
        
        console.log("add at fixed position in document result:", textFrame);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TextFrameCollection.addAnchoredAtLocation Method](https://docs.textcontrol.com/ds-server/reference/javascript/textframecollection/addanchoredatlocation-method/llms-full.txt)
- **Next:** [Javascript: TextFrameCollection.addAtFixedPositionOnPage Method](https://docs.textcontrol.com/ds-server/reference/javascript/textframecollection/addatfixedpositiononpage-method/llms-full.txt)
