Javascript: PageNumberFieldCollection.remove Method
Description
Removes a page number from a header or footer of a Text control document.
Syntax
<void> PageNumberFieldCollection.remove(<PageNumberField> field, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| field | Specifies the field to remove. |
| callback | Optional. Receives true, if the field could be removed. Otherwise, it is false. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates PageNumberFieldCollection.remove in a practical document-editing workflow. It removes a page number from a header or footer of a Text control document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function remove(field) {
TXTextControl.textParts.getMainText(function(mainText) {
const pageNumberFields = mainText.pageNumberFields;
pageNumberFields.remove(
field,
function(result) {
if (result) {
console.log("remove is available.");
} else {
console.warn("remove is not available in the current document state.");
}
},
onTxError
);
}, onTxError);
}