EmbeddedFile Object
Description
The EmbeddedFile class represents a file embedded in another document.
Syntax
EmbeddedFileExamples
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
| Method | Description |
|---|---|
| getCreationDate | Gets the file's creation date as a unix timestamp. |
| getData | Gets the file's data as a base64 string. |
| getDescription | Gets an optional file description. |
| getFileName | Gets the file's name. |
| getLastModificationDate | Gets the date the file was last modified as a unix timestamp. |
| getMIMEType | Gets 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. |
| getRelationship | 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". |
| setCreationDate | Sets the file's creation date as a unix timestamp. |
| setDescription | Sets an optional file description. |
| setLastModificationDate | Sets the date the file was last modified as a unix timestamp. |
| setMIMEType | Sets 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. |
| setRelationship | 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". |