# Javascript: Barcode.getText Method

> Gets the text encrypted by the barcode.

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

---

### Description

Gets the text encrypted by the barcode.

### Syntax

```javascript
<void> Barcode.getText(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the encrypted text. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Barcode.getText` in a practical document-editing workflow. It gets the text encrypted by the barcode.

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

function inspectText(barcode) {
    barcode.getText(
        function(result) {
            console.log("get text result:", result);
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: Barcode.getShowText Method](https://docs.textcontrol.com/ds-server/reference/javascript/barcode/getshowtext-method/llms-full.txt)
- **Next:** [Javascript: Barcode.getTextAlignment Method](https://docs.textcontrol.com/ds-server/reference/javascript/barcode/gettextalignment-method/llms-full.txt)
