PdfEmbeddedFile Class

A file embedded in a document (ISO 32000-2, 7.11.4): a file specification dictionary whose embedded file stream holds the bytes of the file. The files of the document are in PdfDocument.EmbeddedFiles, the files of a page in its file attachment annotations (PdfFileAttachmentAnnotation).

public sealed class PdfEmbeddedFile

Properties

NameDescription
CreationDateGets the date the file was created (/Params /CreationDate), or null.
DescriptionGets the description of the file (/Desc), or null.
DictionaryGets the file specification dictionary.
FileNameGets the name of the file: /UF, or /F, or the key of the name tree of the document.
MimeTypeGets the MIME type of the file (/Subtype of the embedded file stream), or null.
ModificationDateGets the date the file was last modified (/Params /ModDate), or null.
ReferenceGets the reference to the file specification, or null for a direct object.
RelationshipGets how the file relates to the content of the document (/AFRelationship); PdfAssociatedFileRelationship.Unspecified when it is missing or unknown.
SizeGets the size of the file in bytes (/Params /Size), or null when the file does not give it.

CreationDate

PdfEmbeddedFile.cs

Gets the date the file was created (/Params /CreationDate), or null.

public DateTimeOffset? CreationDate { get; }

Property value

DateTimeOffset?

Gets the description of the file (/Desc), or null.

public string? Description { get; }

Property value

string?

Gets the file specification dictionary.

public PdfDictionary Dictionary { get; }

Property value

PdfDictionary

Gets the name of the file: /UF, or /F, or the key of the name tree of the document.

public string FileName { get; }

Property value

string

Gets the MIME type of the file (/Subtype of the embedded file stream), or null.

public string? MimeType { get; }

Property value

string?

ModificationDate

PdfEmbeddedFile.cs

Gets the date the file was last modified (/Params /ModDate), or null.

public DateTimeOffset? ModificationDate { get; }

Property value

DateTimeOffset?

Gets the reference to the file specification, or null for a direct object.

public PdfReference? Reference { get; }

Property value

PdfReference?

Relationship

PdfEmbeddedFile.cs

Gets how the file relates to the content of the document (/AFRelationship); PdfAssociatedFileRelationship.Unspecified when it is missing or unknown.

public PdfAssociatedFileRelationship Relationship { get; }

Gets the size of the file in bytes (/Params /Size), or null when the file does not give it.

public long? Size { get; }

Property value

long?

Methods

NameDescription
GetData()Gets the content of the file.

Gets the content of the file.

public byte[] GetData()

Returns

byte[] The bytes of the file.

Exceptions

InvalidPdfContentException
The file specification has no embedded file stream, or the stream cannot be decoded.
PdfResourceLimitException
The decoded file exceeds PdfReadOptions.MaxDecodedStreamLength.