# Javascript: ImageCollection.addAtFixedPositionInDocument Method

> Creates and inserts a new image which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

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

---

### Description

Creates and inserts a new image which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

### Syntax

```javascript
<void> ImageCollection.addAtFixedPositionInDocument(<string> imageData, <Point> location, <ImageInsertionMode> insertionMode, [<RequestImageCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| imageData | The base64 encoded image data. |
| location | Specifies the location, in twips, at which the image is to be inserted. This is a location relative to the top left corner of the complete document. All gaps between the pages must be included. |
| insertionMode | Specifies how the text flow is handled. |
| callback | Optional. The newly created image object is returned via this callback. |
| errorCallback | Optional. Is called when the operation failed with an error. function. |

### Examples

The following example demonstrates `ImageCollection.addAtFixedPositionInDocument` in a practical document-editing workflow. It creates and inserts a new image which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.

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

TXTextControl.images.addAtFixedPositionInDocument(
    "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAFgAH/qbPzWQAAAABJRU5ErkJggg==",
    { x: 1440, y: 720 },
    TXTextControl.ImageInsertionMode.AsCharacter,
    function(image) {
        if (!image) {
            console.warn("No image was returned.");
            return;
        }
        
        console.log("add at fixed position in document result:", image);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: ImageCollection.addAtFixedPosition Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/addatfixedposition-method/llms-full.txt)
- **Next:** [Javascript: ImageCollection.addAtFixedPositionOnPage Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/imagecollection/addatfixedpositiononpage-method/llms-full.txt)
