Javascript: EmbeddedFile.setRelationship Method
Description
PDF/A only. Sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified".
Syntax
<void> EmbeddedFile.setRelationship(<string> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| value | The property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates EmbeddedFile.setRelationship in a practical document-editing workflow. PDF/A only. Sets an optional string describing the relationship of the embedded file and the containing document. This string can be a predefined value or should follow the rules for second-class names (ISO 32000-1, Annex E). Predefined values are "Source", "Data", "Alternative", "Supplement" or "Unspecified".
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const embeddedFiles = mainText.embeddedFiles;
embeddedFiles.getItem(function(embeddedFile) {
if (!embeddedFile) {
console.warn("No embedded file is available at the current input position.");
return;
}
embeddedFile.setRelationship(
"Quarterly report",
function() {
console.log("set relationship completed.");
},
onTxError
);
}, onTxError);
}, onTxError);