Javascript: BarcodeCollection.addInline Method
Description
Creates and inserts a new barcode inline, which means that it is treated in the text like a single character. The barcode is inserted at the specified text input position.
Syntax
<void> BarcodeCollection.addInline(<RequestBarcodeFrameCallback> callback, [<ErrorCallback> errorCallback], <BarcodeType> barcodeType, <string> text, [<number> textPosition])Parameters
| Parameter | Description |
|---|---|
| callback | The newly created barcode object is returned via this callback function. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| barcodeType | The barcode type. |
| text | The text the barcode should encrypt. |
| textPosition | Optional. Specifies the text position at which the barcode is to be inserted. If -1 or no value is specified, the barcode is inserted at the current input position. |
Examples
The following example demonstrates BarcodeCollection.addInline in a practical document-editing workflow. It creates and inserts a new barcode inline, which means that it is treated in the text like a single character. The barcode is inserted at the specified text input position.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function addInline(barcodeType) {
TXTextControl.barcodes.addInline(
function(barcodeFrame) {
if (!barcodeFrame) {
console.warn("No barcode frame was returned.");
return;
}
console.log("add inline result:", barcodeFrame);
},
onTxError,
barcodeType,
"Quarterly report",
-1
);
}