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

    Show / Hide Table of Contents

    PdfAssociatedFileCollection Class

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

    Represents a collection of associated files that provide a means to associate content in other formats with selected objects of a PDF file and to identify the relationship between them.

    For associated files their associated PdfFileSpecification shall include the AssociatedRelationshipType property indicating one of several possible relationships that the file has to the associated PDF object.

    • C#
    • VB.NET
    public sealed class PdfAssociatedFileCollection : PdfOptionalCollection<PdfFileSpecification>, IList, ICollection, IList<PdfFileSpecification>, ICollection<PdfFileSpecification>, IReadOnlyList<PdfFileSpecification>, IReadOnlyCollection<PdfFileSpecification>, IEnumerable<PdfFileSpecification>, IEnumerable
    Public NotInheritable Class PdfAssociatedFileCollection
        Inherits PdfOptionalCollection(Of PdfFileSpecification)
        Implements IList, ICollection, IList(Of PdfFileSpecification), ICollection(Of PdfFileSpecification), IReadOnlyList(Of PdfFileSpecification), IReadOnlyCollection(Of PdfFileSpecification), IEnumerable(Of PdfFileSpecification), IEnumerable
    Inheritance:
    System.Object
    PdfObject
    PdfCollection
    PdfCollection<PdfFileSpecification>
    PdfOptionalCollection<PdfFileSpecification>
    PdfAssociatedFileCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<PdfFileSpecification>
    System.Collections.Generic.ICollection<PdfFileSpecification>
    System.Collections.Generic.IReadOnlyList<PdfFileSpecification>
    System.Collections.Generic.IReadOnlyCollection<PdfFileSpecification>
    System.Collections.Generic.IEnumerable<PdfFileSpecification>
    System.Collections.IEnumerable

    Methods

    Add(PdfAssociatedFileRelationshipType, String, String, PdfEmbeddedFileSpecificationTree)

    Adds a new PdfFileSpecification with the specified relationship and the EmbeddedFile copied from the resource specified by the filePath.

    • C#
    • VB.NET
    public PdfFileSpecification Add(PdfAssociatedFileRelationshipType associatedRelationshipType, string filePath, string mediaType = null, PdfEmbeddedFileSpecificationTree embeddedFiles = null)
    Public Function Add(associatedRelationshipType As PdfAssociatedFileRelationshipType, filePath As String, mediaType As String = Nothing, embeddedFiles As PdfEmbeddedFileSpecificationTree = Nothing) As PdfFileSpecification
    Parameters
    associatedRelationshipType
    PdfAssociatedFileRelationshipType

    The relationship between the component of a PDF document that refers to this PdfAssociatedFileCollection and the newly added PdfFileSpecification.

    filePath
    System.String

    The location of the resource copied to the EmbeddedFile of a newly added PdfFileSpecification. This value is also used to resolve the Name and a key in the PdfEmbeddedFileSpecificationTree (if embeddedFiles is not null) of a newly added PdfFileSpecification.

    mediaType
    System.String

    The media type of the embedded file.

    embeddedFiles
    PdfEmbeddedFileSpecificationTree

    The EmbeddedFiles to which the newly created PdfFileSpecification should be added or null.

    Returns
    PdfFileSpecification

    A newly created PdfFileSpecification with the specified relationship and the EmbeddedFile copied from the resource specified by the filePath added to the PdfAssociatedFileCollection.

    Remarks

    The EmbeddedFile's Size, CreationDate, ModificationDate, and MediaType properties are automatically set, if they can be resolved from the resource specified by the filePath.

    Exceptions
    System.ArgumentNullException

    filePath is null or System.String.Empty.

    AddEmpty(PdfAssociatedFileRelationshipType, String, String, PdfEmbeddedFileSpecificationTree)

    Adds a new PdfFileSpecification with the specified relationship and an empty EmbeddedFile.

    Use the OpenWrite(Boolean) method of the EmbeddedFile of a returned PdfFileSpecification to fill the empty EmbeddedFile.

    • C#
    • VB.NET
    public PdfFileSpecification AddEmpty(PdfAssociatedFileRelationshipType associatedRelationshipType, string fileSpecificationName, string mediaType = null, PdfEmbeddedFileSpecificationTree embeddedFiles = null)
    Public Function AddEmpty(associatedRelationshipType As PdfAssociatedFileRelationshipType, fileSpecificationName As String, mediaType As String = Nothing, embeddedFiles As PdfEmbeddedFileSpecificationTree = Nothing) As PdfFileSpecification
    Parameters
    associatedRelationshipType
    PdfAssociatedFileRelationshipType

    The relationship between the component of a PDF document that refers to this PdfAssociatedFileCollection and the newly added PdfFileSpecification.

    fileSpecificationName
    System.String

    The name of a newly added PdfFileSpecification. This value is also used to resolve a key in the PdfEmbeddedFileSpecificationTree (if embeddedFiles is not null) of a newly added PdfFileSpecification.

    mediaType
    System.String

    The media type of the embedded file.

    embeddedFiles
    PdfEmbeddedFileSpecificationTree

    The EmbeddedFiles to which the newly created PdfFileSpecification should be added or null.

    Returns
    PdfFileSpecification

    A newly created PdfFileSpecification with the specified relationship and an empty EmbeddedFile added to the PdfAssociatedFileCollection.

    Exceptions
    System.ArgumentNullException

    fileSpecificationName is null or System.String.Empty.

    Inherited Properties

    Count

    Gets the number of elements contained in the PdfCollection.

    (Inherited from PdfCollection)

    Metadata

    (Optional; PDF 1.4) A metadata stream containing metadata for the component.

    (Inherited from PdfObject)

    Inherited Methods

    Clear()

    Removes all elements from the PdfCollection.

    (Inherited from PdfCollection)

    RemoveAt(System.Int32)

    Removes the element at the specified index of the PdfCollection.

    (Inherited from PdfCollection)

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    Extension Methods

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

    Examples

    Associated Files example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.