TX Text Control .NET Server

Javascript: DocumentSettings.setUserDefinedDocumentProperties Method

Method|Introduced in 29.0

Description

Sets an object with all user-defined document properties contained in the current document.

Syntax

<void> DocumentSettings.setUserDefinedDocumentProperties(<object> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
value

The property value.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example shows how to set two custom document properties (one named "numerical_property", the other one "my custom string property")

TXTextControl.documentSettings.setUserDefinedDocumentProperties({
   numerical_property: 42,
   "my custom string property": "text" // Property names containing whitespaces have to be put in quotes
});

The following example demonstrates DocumentSettings.setUserDefinedDocumentProperties in a practical document-editing workflow. It sets an object with all user-defined document properties contained in the current document.

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

TXTextControl.documentSettings.setUserDefinedDocumentProperties(
    {},
    function() {
        console.log("set user defined document properties completed.");
    },
    onTxError
);