DS Server

EmbeddedFile Object

Object|Introduced in 29.0

Description

The EmbeddedFile class represents a file embedded in another document.

Syntax

EmbeddedFile

Examples

The following example demonstrates EmbeddedFile in a practical document-editing workflow. The EmbeddedFile class represents a file embedded in another document.

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.getCreationDate(
            function(result) {
                console.log("get creation date result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);

Members

Methods

MethodDescription
getCreationDateGets the file's creation date as a unix timestamp.
getDataGets the file's data as a base64 string.
getDescriptionGets an optional file description.
getFileNameGets the file's name.
getLastModificationDateGets the date the file was last modified as a unix timestamp.
getMIMETypeGets an optional string specifying the file's type using types specified through the Multipurpose Internet Mail Extensions (MIME) specification. When a file is embedded and a type is not specified the default type application/octet-stream is used.
getRelationshipPDF/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".
setCreationDateSets the file's creation date as a unix timestamp.
setDescriptionSets an optional file description.
setLastModificationDateSets the date the file was last modified as a unix timestamp.
setMIMETypeSets an optional string specifying the file's type using types specified through the Multipurpose Internet Mail Extensions (MIME) specification. When a file is embedded and a type is not specified the default type application/octet-stream is used.
setRelationshipPDF/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".