# Javascript: TextFrame.getLocation Method

> Gets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline.

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

---

### Description

Gets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline.

### Syntax

```javascript
<void> TextFrame.getLocation(<RequestPointCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the current property value. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TextFrame.getLocation` in a practical document-editing workflow. Gets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline.

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

function inspectLocation(textFrame) {
    textFrame.getLocation(
        function(position) {
            if (!position) {
                console.warn("No point was returned.");
                return;
            }
            
            console.log("get location result:", position);
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TextFrame.getInternalMargins Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textframe/getinternalmargins-method/llms-full.txt)
- **Next:** [Javascript: TextFrame.getMoveable Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textframe/getmoveable-method/llms-full.txt)
