GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfEmbeddedFile Class

    Namespace:
    GemBox.Pdf
    Assembly:
    GemBox.Pdf.dll

    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.

    • C#
    • VB.NET
    public sealed class PdfEmbeddedFile : PdfObject
    Public NotInheritable Class PdfEmbeddedFile
        Inherits PdfObject
    Inheritance:
    System.Object
    PdfObject
    PdfEmbeddedFile

    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.

    • C#
    • VB.NET
    public byte[] CheckSum { get; set; }
    Public Property CheckSum As Byte()
    Property Value
    System.Byte[]

    A 16-byte array that is the checksum of the bytes of the uncompressed embedded file.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'

    CompressedSize

    Gets the size of the compressed embedded file, in bytes.

    • C#
    • VB.NET
    public int CompressedSize { get; }
    Public ReadOnly Property CompressedSize As Integer
    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".

    • C#
    • VB.NET
    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
    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'

    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.

    • C#
    • VB.NET
    public string MediaType { get; set; }
    Public Property MediaType As String
    Property Value
    System.String

    The media type of the embedded file.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'

    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".

    • C#
    • VB.NET
    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
    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'

    Size

    (Optional) The size of the uncompressed embedded file, in bytes. See "Table 157: Entries in a collection field dictionary".

    • C#
    • VB.NET
    public int? Size { get; set; }
    Public Property Size As Integer?
    Property Value
    System.Nullable<System.Int32>

    The size of the uncompressed embedded file, in bytes.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'

    Methods

    OpenRead()

    Opens this PdfEmbeddedFile so its data can be read. The data is automatically uncompressed, if needed.

    • C#
    • VB.NET
    public Stream OpenRead()
    Public Function OpenRead As Stream
    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.

    • C#
    • VB.NET
    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)

    Extension Methods

    PdfObjectExtensions.GetDictionary(PdfObject)
    PdfObjectExtensions.GetOrAddDictionary(PdfObject)
    PdfObjectExtensions.GetArray(PdfObject)

    Examples

    Embedded Files example
    Embedded Files example
    Associated Files example

    See Also

    PDF Specification ISO 32000-1:2008, section '7.11.4 Embedded File Streams'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.