DS Server

Javascript: FootnoteCollection.add Method

Method|Introduced in 32.0

Description

Adds a new footnote with the given text to the document at the current input position. A footnote consists of a reference mark in the document and the footnote itself appearing at the bottom of the page.

Syntax

<void> FootnoteCollection.add(<string> text, <string> name, <number> id, <AddFootnoteCallback> callback, <ErrorCallback> errorCallback)

Parameters

ParameterDescription
text

The footnote's text.

name

The footnote's name. Set this to null or an empty string to not set a name.

id

The footnote's numerical id. Set this to null or 0 to not set an id.

callback

The callback function that receives the added footnote.

errorCallback

Is called when the operation failed with an error.

Examples

The following example inserts a named footnote and reads its assigned document number.

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

TXTextControl.footnotes.add("Reviewed against the 2026 policy.", "PolicyNote", 25, function(response) {
    if (!response.added || !response.footnote) {
        console.warn("The footnote could not be inserted at the current input position.");
        return;
    }

    response.footnote.getNumber(function(number) {
        console.log("Policy footnote number:", number);
    }, onTxError);
}, onTxError);