Javascript: TextCharCollection.add Method
Description
Inserts a character at the specified position using the specified font.
Syntax
<void> TextCharCollection.add(<string> character, <string> fontName, <number> textPosition, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| character | Specifies the character to insert. |
| fontName | Specifies the name of the font which is used for the specified character. |
| textPosition | Specifies a text input position. The first input position in a document is 0. |
| callback | Optional. Receives whether the character is succesfully inserted. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TextCharCollection.add in a practical document-editing workflow. It inserts a character at the specified position using the specified font.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function add(textChars) {
textChars.add(
"Quarterly report",
"Arial",
-1,
function(result) {
if (result) {
console.log("add is available.");
} else {
console.warn("add is not available in the current document state.");
}
},
onTxError
);
}