TX Text Control .NET Server

EmbeddedFile Class

Class|Introduced in 29.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

The EmbeddedFile class represents a file embedded in another document. It is used with the LoadSettings.EmbeddedFiles and SaveSettings.EmbeddedFiles properties, currently only supported for PDF and PDF/A documents. An embedded file is specified through its name and its data and further optional properties such as a description string or a creation date.

Syntax

public class EmbeddedFile

Examples

The following example embeds a PDF attachment and preserves its media type during WordprocessingML export.

EmbeddedFile embeddedFile = new("terms.pdf", @"Attachments\terms.pdf", "application/pdf");
SaveSettings saveSettings = new() { EmbeddedFiles = new[] { embeddedFile } };
textControl.Save("contract-with-attachment.docx", StreamType.WordprocessingML, saveSettings);

Members

Constructors

ConstructorDescription
EmbeddedFileInitializes a new instance of the EmbeddedFile class.

Properties

PropertyDescription
CreationDateGets or sets the file's creation date. When a document is saved and this property is null, the creation date of the embedded file is set to the creation date of the containing document.
DataGets the file's data. It can be either a string or binary data given as an array of bytes.
DescriptionGets or sets an optional file description. It is null, if the file has no description.
FileNameGets the file's name. It can include a relative or absolute path.
LastModificationDateGets or sets the date the file was last modified. When a document is saved and this property is null, the modification date of the embedded file is set to the modification date of the containing document.
MIMETypeGets or 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.
RelationshipPDF/A only. Gets or 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". It is null, if a relationship string is not available.

Methods

MethodDescription
GetUnmanagedBufferSizeNot described in the reference. public int GetUnmanagedBufferSize();

Further Reading

  • Adding Attachments to Adobe PDF Documents using C# –