# Javascript: TextFrameCollection.addInline Method

> Inserts a text frame inline, which means that it is treated in the text like a single character. The text frame is inserted at the specified text input position.

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

---

### Description

Inserts a text frame inline, which means that it is treated in the text like a single character. The text frame is inserted at the specified text input position.

### Syntax

```javascript
<void> TextFrameCollection.addInline(<Size> size, <number> textPosition, [<ErrorCallback> errorCallback], [<RequestTextFrameCallback> callback])
```

### Parameters

| Parameter | Description |
|---|---|
| size | The text frame's size in twips. |
| textPosition | Specifies the text position at which the text frame is to be inserted. If -1 is specified, the text frame is inserted at the current input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| callback | Optional. The newly created text frame object is returned via this callback function. |

### Examples

The following example demonstrates `TextFrameCollection.addInline` in a practical document-editing workflow. It inserts a text frame inline, which means that it is treated in the text like a single character. The text frame is inserted at the specified text input position.

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

TXTextControl.textFrames.addInline(
    { width: 2880, height: 1440 },
    -1,
    onTxError,
    function(textFrame) {
        if (!textFrame) {
            console.warn("No text frame was returned.");
            return;
        }
        
        console.log("add inline result:", textFrame);
    }
);
```

---

## Nearby

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