# Javascript: BarcodeCollection.addInline Method

> Creates and inserts a new barcode inline, which means that it is treated in the text like a single character. The barcode is inserted at the specified text input position.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: BarcodeCollection.addInline Method
- **559 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addinline-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addinline-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addinline-method/llms-full.txt

---

### Description

Creates and inserts a new barcode inline, which means that it is treated in the text like a single character. The barcode is inserted at the specified text input position.

### Syntax

```javascript
<void> BarcodeCollection.addInline(<RequestBarcodeFrameCallback> callback, [<ErrorCallback> errorCallback], <BarcodeType> barcodeType, <string> text, [<number> textPosition])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | The newly created barcode object is returned via this callback function. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| barcodeType | The barcode type. |
| text | The text the barcode should encrypt. |
| textPosition | Optional. Specifies the text position at which the barcode is to be inserted. If -1 or no value is specified, the barcode is inserted at the current input position. |

### Examples

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

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

function addInline(barcodeType) {
    TXTextControl.barcodes.addInline(
        function(barcodeFrame) {
            if (!barcodeFrame) {
                console.warn("No barcode frame was returned.");
                return;
            }
            
            console.log("add inline result:", barcodeFrame);
        },
        onTxError,
        barcodeType,
        "Quarterly report",
        -1
    );
}
```

---

## Nearby

- **Previous:** [Javascript: BarcodeCollection.addAtFixedPositionOnPage Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addatfixedpositiononpage-method/llms-full.txt)
- **Next:** [Javascript: BarcodeCollection.addWithMouse Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addwithmouse-method/llms-full.txt)
