Skip to content

PdfDocumentFileAttachment.GetPayloadStream Method

GetPayloadStream()

Gets the decoded stream containing the content of the embedded file attachment, if available.

C#
public Stream GetPayloadStream()

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 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 Payload property and allows for more efficient memory usage when reading the content.