Javascript: SignatureFieldCollection.addAnchored Method
Description
Creates and inserts a new signature field which is anchored to the specified text position. It has the specified horizontal alignment and a textflow which is given through the insertionMode parameter. Anchored text frames are moved with the text.
Syntax
<void> SignatureFieldCollection.addAnchored(<Size> size, <HorizontalAlignment> horizontalAlignment, <number> textPosition, <FrameInsertionMode> insertionMode, [<RequestSignatureFieldCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| size | The signature field's size in twips. |
| horizontalAlignment | Specifies the signature field's horizontal alignment. |
| textPosition | Specifies the text position at which the signature field is to be inserted. If -1 is specified, the signature field is inserted at the current input position. |
| insertionMode | Specifies how the text flow is handled. |
| callback | Optional. The newly created signature field object is returned via this callback function. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates SignatureFieldCollection.addAnchored in a practical document-editing workflow. It creates and inserts a new signature field which is anchored to the specified text position. It has the specified horizontal alignment and a textflow which is given through the insertionMode parameter. Anchored text frames are moved with the text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.signatureFields.addAnchored(
{ width: 2880, height: 1440 },
TXTextControl.HorizontalAlignment.Center,
-1,
TXTextControl.FrameInsertionMode.AsCharacter,
function(signatureField) {
if (!signatureField) {
console.warn("No signature field was returned.");
return;
}
console.log("add anchored result:", signatureField);
},
onTxError
);