DS Server

Javascript: EmbeddedFile.getRelationship Method

Method|Introduced in 29.0

Description

PDF/A only. Gets 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.getRelationship(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the property value.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates EmbeddedFile.getRelationship in a practical document-editing workflow. PDF/A only. Gets 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.getRelationship(
            function(result) {
                console.log("get relationship result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);