PdfEmbeddedFile Class
Represents an embedded file stream (PDF 1.3) that enables embedding the contents of referenced files directly within the body of the PDF file. This makes the PDF file a self-contained unit that can be stored or transmitted as a single entity.
public sealed class PdfEmbeddedFile : PdfObject
Public NotInheritable Class PdfEmbeddedFile
Inherits PdfObject
- Inheritance:
- System.ObjectPdfEmbeddedFile
Properties
CheckSum
(Optional) A 16-byte array that is the checksum of the bytes of the uncompressed embedded file. The checksum shall be calculated by applying the standard MD5 message-digest algorithm (described in Internet RFC 1321, The MD5 Message-Digest Algorithm) to the bytes of the embedded file stream.
note
This is strictly a checksum, and is not used for security purposes.
Property Value
- System.Byte[]
A 16-byte array that is the checksum of the bytes of the uncompressed embedded file.
See Also
CompressedSize
Gets the size of the compressed embedded file, in bytes.
Property Value
- System.Int32
The size of the compressed embedded file, in bytes.
CreationDate
(Optional) The date and time when the embedded file was created. See "Table 157: Entries in a collection field dictionary".
public DateTimeOffset? CreationDate { get; set; }
Public Property CreationDate As DateTimeOffset?
Property Value
- System.Nullable<System.DateTimeOffset>
The date and time when the embedded file was created.
See Also
MediaType
(Optional, required in the case of an embedded file stream used as as associated file) The media type of the embedded file. The value of this entry shall conform to the MIME media type names defined in Internet RFC2046, Multipurpose Internet Mail Extensions (MIME), Part Two: Media Types.
Property Value
- System.String
The media type of the embedded file.
See Also
ModificationDate
(Optional, required in the case of an embedded file stream used as an associated file) The date and time when the embedded file was last modified. See "Table 157: Entries in a collection field dictionary".
public DateTimeOffset? ModificationDate { get; set; }
Public Property ModificationDate As DateTimeOffset?
Property Value
- System.Nullable<System.DateTimeOffset>
The date and time when the embedded file was last modified.
See Also
Size
(Optional) The size of the uncompressed embedded file, in bytes. See "Table 157: Entries in a collection field dictionary".
Property Value
- System.Nullable<System.Int32>
The size of the uncompressed embedded file, in bytes.
See Also
Methods
OpenRead()
Opens this PdfEmbeddedFile so its data can be read. The data is automatically uncompressed, if needed.
Returns
- System.IO.Stream
A System.IO.Stream that can be used to read PdfEmbeddedFile data.
Remarks
Returned System.IO.Stream must be disposed after it is no longer needed, otherwise, subsequent opening of PdfEmbeddedFile will fail.
Exceptions
- System.InvalidOperationException
PdfStream is already opened. Make sure that System.IO.Stream instance returned from OpenRead() or OpenWrite(Boolean) method is disposed before calling OpenRead() method again.
- System.NotSupportedException
PdfStream specifies external data (through F entry) that is currently not supported.
OpenWrite(Boolean)
Opens this PdfEmbeddedFile so its data can be written.
public Stream OpenWrite(bool compress = true)
Public Function OpenWrite(compress As Boolean = True) As Stream
Parameters
compress
- System.Boolean
If set to true then the written data is compressed using the FlateDecode data compression method.
Returns
- System.IO.Stream
A System.IO.Stream that can be used to write PdfEmbeddedFile data.
Remarks
Returned System.IO.Stream must be disposed after it is no longer needed, otherwise, subsequent opening of PdfEmbeddedFile will fail.
Exceptions
- System.InvalidOperationException
PdfStream is already opened. Make sure that System.IO.Stream instance returned from OpenRead() or OpenWrite(Boolean) method is disposed before calling OpenWrite(Boolean) method again.
Inherited Properties
Metadata | (Optional; PDF 1.4) A metadata stream containing metadata for the component. (Inherited from PdfObject) |