PDFDocumentFileAttachment¶
Namespace: O2S.Components.PDF4NET
Defines an attachment included in a PDF document.
Inheritance Object → PDFDocumentFileAttachment
Constructors¶
PDFDocumentFileAttachment()¶
Initializes a new PDFDocumentFileAttachment object.
PDFDocumentFileAttachment(Byte[])¶
Initializes a new PDFDocumentFileAttachment object with the given content.
Parameters
fileData Byte[]
The binary content to embed in the PDF file.
Properties¶
CreationDate¶
Gets or sets the creation date.
Property Value
DateTime
The date and time when the attachment was created.
Description¶
Gets or sets the file description.
Property Value
String
The description of the file attachment.
FileName¶
Gets or sets the file name.
Property Value
String
The file name corresponding to the content in PDFDocumentFileAttachment.Payload property.
MimeType¶
Gets or sets the MIME type.
Property Value
String
The MIME type of the attachment.
ModifyDate¶
Gets or sets the modify date.
Property Value
DateTime
The date and time when the attachment was modified.
Payload¶
Gets or sets the attachment content.
Property Value
Byte[]
The content of the attachment.
RelationshipToOwner¶
Gets or sets the relationship between the file attachment and its owner.
Property Value
PDFDocumentFileAttachmentRelationship
A PDFDocumentFileAttachmentRelationship enumeration member specifying how the file attachment is
related to its owner.
Methods¶
GetPayloadStream()¶
Gets the decoded stream containing the content of the embedded file attachment, if available.
Returns
Stream
A stream representing the decoded content of the embedded file attachment, or null if no content is present.
Remarks
This method returns a stream representing the decoded content of the embedded file attachment. If the
attachment content is not present or cannot be decoded, it returns null. The caller is responsible for
disposing the returned stream when it is no longer needed.
The stream returned by this method is
intended for reading the content of the embedded file attachment. Writing to the stream has no effect on the
file attachment content. If you need to modify the content of the attachment, consider using the
PDFDocumentFileAttachment.Payload property instead, which allows you to set the content as a byte array.
Use this
method when dealing with large attachments as it avoids the byte array overhead of the PDFDocumentFileAttachment.Payload property and allows for more efficient memory usage when reading the content.