# Javascript: Barcode.setAlignment Method

> Sets the alignment of the barcode image inside the control.

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

---

### Description

Sets the alignment of the barcode image inside the control.

### Syntax

```javascript
<void> Barcode.setAlignment(<BarcodeAlignment> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| value | The alignment value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Barcode.setAlignment` in a practical document-editing workflow. It sets the alignment of the barcode image inside the control.

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

function configureAlignment(barcode) {
    barcode.setAlignment(
        TXTextControl.BarcodeAlignment.TopLeft,
        function() {
            console.log("set alignment completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: Barcode.setAdditionalText Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcode/setadditionaltext-method/llms-full.txt)
- **Next:** [Javascript: Barcode.setAngle Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcode/setangle-method/llms-full.txt)
