# Javascript: TextField.getFormattingBounds Method

> Gets the formatting rectangle of a text field.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TextField.getFormattingBounds Method
- **381 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfield/getformattingbounds-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfield/getformattingbounds-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfield/getformattingbounds-method/llms-full.txt

---

### Description

Gets the formatting rectangle of a text field.

### Syntax

```javascript
<void> TextField.getFormattingBounds(<RequestRectangleCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

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

### Examples

The following example demonstrates `TextField.getFormattingBounds` in a practical document-editing workflow. It gets the formatting rectangle of a text field.

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

function inspectFormattingBounds(textField) {
    textField.getFormattingBounds(
        function(rect) {
            if (!rect) {
                console.warn("No rectangle was returned.");
                return;
            }
            
            console.log("get formatting bounds result:", rect);
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TextField.getEditable Method](https://docs.textcontrol.com/ds-server/reference/javascript/textfield/geteditable-method/llms-full.txt)
- **Next:** [Javascript: TextField.getHighlightColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/textfield/gethighlightcolor-method/llms-full.txt)
