Javascript: BarcodeCollection.addAtFixedPositionInDocument Method
Description
Creates and inserts a new barcode which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.
Syntax
<void> BarcodeCollection.addAtFixedPositionInDocument(<RequestBarcodeFrameCallback> callback, [<ErrorCallback> errorCallback], <BarcodeType> barcodeType, <string> text, <Point> location, <FrameInsertionMode> insertionMode)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. |
| location | Specifies the location, in twips, at which the barcode is to be inserted. This is a location relative to the top left corner of the complete document. All gaps between the pages must be included. |
| insertionMode | Specifies how the text flow is handled. |
Examples
The following example demonstrates BarcodeCollection.addAtFixedPositionInDocument in a practical document-editing workflow. It creates and inserts a new barcode which has a fixed geometrical position in the document. This position is specified through a location relative to the top left corner of the complete document. All gaps between the pages must be included.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function addAtFixedPositionInDocument(barcodeType) {
TXTextControl.barcodes.addAtFixedPositionInDocument(
function(barcodeFrame) {
if (!barcodeFrame) {
console.warn("No barcode frame was returned.");
return;
}
console.log("add at fixed position in document result:", barcodeFrame);
},
onTxError,
barcodeType,
"Quarterly report",
{ x: 1440, y: 720 },
TXTextControl.FrameInsertionMode.AsCharacter
);
}