Javascript: TextFrameCollection.addInline Method
Description
Inserts a text frame inline, which means that it is treated in the text like a single character. The text frame is inserted at the specified text input position.
Syntax
<void> TextFrameCollection.addInline(<Size> size, <number> textPosition, [<ErrorCallback> errorCallback], [<RequestTextFrameCallback> callback])Parameters
| Parameter | Description |
|---|---|
| size | The text frame's size in twips. |
| textPosition | Specifies the text position at which the text frame is to be inserted. If -1 is specified, the text frame is inserted at the current input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| callback | Optional. The newly created text frame object is returned via this callback function. |
Examples
The following example demonstrates TextFrameCollection.addInline in a practical document-editing workflow. It inserts a text frame inline, which means that it is treated in the text like a single character. The text frame is inserted at the specified text input position.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textFrames.addInline(
{ width: 2880, height: 1440 },
-1,
onTxError,
function(textFrame) {
if (!textFrame) {
console.warn("No text frame was returned.");
return;
}
console.log("add inline result:", textFrame);
}
);