TX Text Control .NET Server

Javascript: ImageCollection.getItemByName Method

Method|Introduced in 28.0

Description

Gets the image with the specified name.

Syntax

<void> ImageCollection.getItemByName(<RequestImageCallback> callback, [<ErrorCallback> errorCallback], <string> name)

Parameters

ParameterDescription
callback

Receives the requested image or null if no image with the specified name exists.

errorCallback

Optional. Is called when the operation failed with an error.

name

The image's name.

Examples

The following example demonstrates ImageCollection.getItemByName in a practical document-editing workflow. It gets the image with the specified name.

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

TXTextControl.images.getItemByName(
    function(image) {
        if (!image) {
            console.warn("No image was returned.");
            return;
        }
        
        console.log("get item by name result:", image);
    },
    onTxError,
    "CompanyLogo"
);