# Javascript: Barcode.setBarcodeType Method

> Sets the type of barcode that is rendered.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: Barcode.setBarcodeType Method
- **347 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/barcode/setbarcodetype-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/barcode/setbarcodetype-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/barcode/setbarcodetype-method/llms-full.txt

---

### Description

Sets the type of barcode that is rendered.

### Syntax

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

### Parameters

| Parameter | Description |
|---|---|
| value | The barcode type. |
| 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.setBarcodeType` in a practical document-editing workflow. It sets the type of barcode that is rendered.

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

function configureBarcodeType(barcode, value) {
    barcode.setBarcodeType(
        value,
        function() {
            console.log("set barcode type completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: Barcode.setBackColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/barcode/setbackcolor-method/llms-full.txt)
- **Next:** [Javascript: Barcode.setForeColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/barcode/setforecolor-method/llms-full.txt)
