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

    Show / Hide Table of Contents

    PdfCollection<T> Class

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

    Represents a base class for all collection types that implement various PDF components in the GemBox.Pdf assembly.

    • C#
    • VB.NET
    public abstract class PdfCollection<T> : PdfCollection, IList, ICollection, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
    Public MustInherit Class PdfCollection(Of T)
        Inherits PdfCollection
        Implements IList, ICollection, IList(Of T), ICollection(Of T), IReadOnlyList(Of T), IReadOnlyCollection(Of T), IEnumerable(Of T), IEnumerable
    Type Parameters
    T

    The type of elements in the collection.

    Inheritance:
    System.Object
    PdfObject
    PdfCollection
    PdfCollection<T>
    Derived
    PdfActionCollection
    PdfFieldCollection
    PdfFormActionSelectedFieldCollection
    PdfSignatureLockedFieldCollection
    PdfNumberRangeCollection
    PdfOptionalCollection<T>
    PdfOutlineCollection
    PdfPageObjectCollection
    PdfTree<TKey, TValue>
    PdfPortfolioFieldDictionary
    PdfPortfolioFieldValueDictionary
    PdfPortfolioFileCollection
    PdfPortfolioFolderCollection
    PdfPortfolioSortLevelCollection
    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

    Properties

    Item[Int32]

    Gets or sets the element at the specified index.

    • C#
    • VB.NET
    public T this[int index] { get; set; }
    Public Property Item(index As Integer) As T
    Parameters
    index
    System.Int32

    The zero-based index of the element to get or set.

    Property Value
    T

    The element at the specified index.

    Exceptions
    System.InvalidOperationException

    The underlying PdfArray is read-only (IsReadOnly returns true).

    System.ArgumentOutOfRangeException

    index is less than 0 or index is equal to or greater than Count.

    System.ArgumentException

    value is invalid for the current collection.

    Methods

    Add(T)

    Adds an element to the end of the PdfCollection<T>.

    • C#
    • VB.NET
    public void Add(T item)
    Public Sub Add(item As T)
    Parameters
    item
    T

    The element to be added to the end of the PdfCollection<T>.

    Exceptions
    System.InvalidOperationException

    The underlying PdfArray is read-only (IsReadOnly returns true).

    System.ArgumentException

    item is invalid for the current collection.

    Contains(T)

    Determines whether an element is in the PdfCollection<T>.

    • C#
    • VB.NET
    public bool Contains(T item)
    Public Function Contains(item As T) As Boolean
    Parameters
    item
    T

    The element to locate in the PdfCollection<T>.

    Returns
    System.Boolean

    true if item is found in the PdfCollection<T>; otherwise, false.

    CopyTo(T[], Int32)

    Copies the entire PdfCollection<T> to a compatible one-dimensional array, starting at the specified index of the target array.

    • C#
    • VB.NET
    public void CopyTo(T[] array, int arrayIndex)
    Public Sub CopyTo(array As T(), arrayIndex As Integer)
    Parameters
    array
    T[]

    The one-dimensional System.Array that is the destination of the elements copied from PdfCollection<T>. The System.Array must have zero-based indexing.

    arrayIndex
    System.Int32

    The zero-based index in array at which copying begins.

    Exceptions
    System.ArgumentNullException

    array is null.

    System.ArgumentOutOfRangeException

    arrayIndex is less than 0 or greater than array's System.Array.Length.

    System.ArgumentException

    The number of elements in the source PdfCollection<T> is greater than the available space from arrayIndex to the end of the destination array.

    GetEnumerator()

    Returns an enumerator that iterates through the PdfCollection<T>.

    • C#
    • VB.NET
    public PdfCollection<T>.Enumerator GetEnumerator()
    Public Function GetEnumerator As PdfCollection(Of T).Enumerator
    Returns
    PdfCollection.Enumerator<>

    A PdfCollection<T>.Enumerator for the PdfCollection<T>.

    IndexOf(T)

    Searches for the specified element and returns the zero-based index of the first occurrence within the entire PdfCollection<T>.

    • C#
    • VB.NET
    public int IndexOf(T item)
    Public Function IndexOf(item As T) As Integer
    Parameters
    item
    T

    The element to locate in the PdfCollection<T>.

    Returns
    System.Int32

    The zero-based index of the first occurrence of item within the entire PdfCollection<T>, if found; otherwise, –1.

    Insert(Int32, T)

    Inserts an element into the PdfCollection<T> at the specified index.

    • C#
    • VB.NET
    public void Insert(int index, T item)
    Public Sub Insert(index As Integer, item As T)
    Parameters
    index
    System.Int32

    The zero-based index at which item should be inserted.

    item
    T

    The element to insert.

    Exceptions
    System.InvalidOperationException

    The underlying PdfArray is read-only (IsReadOnly returns true).

    System.ArgumentOutOfRangeException

    index is less than 0 or index is greater than Count.

    System.ArgumentException

    item is invalid for the current collection.

    Remove(T)

    Removes the first occurrence of a specific element from the PdfCollection<T>.

    • C#
    • VB.NET
    public bool Remove(T item)
    Public Function Remove(item As T) As Boolean
    Parameters
    item
    T

    The element to remove from the PdfCollection<T>.

    Returns
    System.Boolean

    true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the PdfCollection<T>.

    Exceptions
    System.InvalidOperationException

    The underlying PdfArray is read-only (IsReadOnly returns true).

    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)

    See Also

    PDF Specification ISO 32000-1:2008, section '7.7 Document Structure'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.