DS Server

PageNumberFieldCollection Object

Object|Introduced in 30.0

Description

Contains the page number fields in a header or footer of a Text Control document.

Syntax

PageNumberFieldCollection

Examples

The following example demonstrates PageNumberFieldCollection in a practical document-editing workflow. It contains the page number fields in a header or footer of a Text Control document.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const pageNumberFields = mainText.pageNumberFields;
    pageNumberFields.getItem(
        function(field) {
            if (!field) {
                console.warn("No pagenumber field was returned.");
                return;
            }
            
            console.log("get item result:", field);
        },
        onTxError,
        25
    );
}, onTxError);

Members

Methods

MethodDescription
addInserts a new page number field at the current input position which displays Arabic numbers starting with 1.
getCanAddGets a value indicating whether a new text field can be inserted at the current input position. (Inherited from TextFieldCollectionBase.)
getItemGets the field at the current input position or null, if there is no such field at the current input position.
removeRemoves a page number from a header or footer of a Text control document.