DS Server

Javascript: Selection.load Method

Method|Introduced in 24.0

Description

Loads text in a certain format into the current selection.

Syntax

<void> Selection.load(<StreamType> streamType, <string> base64Data, [<EmptyRequestCallback> callback], [<LoadSettings> loadSettings], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
streamType

Document format.

base64Data

Base64 encoded document data.

callback

Optional. Is called when the operation completed.

loadSettings

Optional. Additional settings for loading the data.

errorCallback

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

Examples

The following example demonstrates Selection.load in a practical document-editing workflow. It loads text in a certain format into the current selection.

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

TXTextControl.selection.load(
    TXTextControl.StreamType.HTMLFormat,
    "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAFgAH/qbPzWQAAAABJRU5ErkJggg==",
    function() {
        console.log("load completed.");
    },
    { loadImages: true, loadHypertextLinks: true },
    onTxError
);