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

    Show / Hide Table of Contents

    PdfTree<TKey, TValue> Class

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

    Represents a base class for name trees and number trees.

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

    The type of the keys in the tree. PdfString for name trees and PdfInteger for number trees.

    TValue

    The type of the values in the tree.

    Inheritance:
    System.Object
    PdfObject
    PdfCollection
    PdfCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    PdfTree<TKey, TValue>
    Derived
    PdfEmbeddedFileSpecificationTree
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.IEnumerable
    Remarks

    PdfString and PdfInteger are used as keys instead of System.String and System.Int32 to avoid, possibly costly, conversions.

    GemBox.Pdf, currently, doesn't maintain the tree's structure when modifying the tree. Instead the entire tree structure is flattened into a single root node.

    Properties

    Item[TKey]

    Gets or sets the value associated with the specified key.

    • C#
    • VB.NET
    public TValue this[TKey key] { get; set; }
    Public Property Item(key As TKey) As TValue
    Parameters
    key
    TKey

    The key of the value to get or set.

    Property Value
    TValue

    The value associated with the specified key. If the specified key is not found, a get operation returns default value. A set operation overrides existing or adds a new entry with the specified key and value.

    Exceptions
    System.ArgumentNullException

    key is null.

    Methods

    Add(TKey, TValue)

    Adds the specified key and value to the tree.

    • C#
    • VB.NET
    public void Add(TKey key, TValue value)
    Public Sub Add(key As TKey, value As TValue)
    Parameters
    key
    TKey

    The key of the entry to add.

    value
    TValue

    The value of the entry to add.

    Exceptions
    System.ArgumentNullException

    key is null.

    System.ArgumentException

    An entry with the same key already exists in the tree.

    ContainsKey(TKey)

    Determines whether the tree contains the specified key.

    • C#
    • VB.NET
    public bool ContainsKey(TKey key)
    Public Function ContainsKey(key As TKey) As Boolean
    Parameters
    key
    TKey

    The key to locate in the tree.

    Returns
    System.Boolean

    true if the tree contains an entry with the specified key; otherwise, false.

    Exceptions
    System.ArgumentNullException

    key is null.

    GetEnumerator()

    Returns an enumerator that iterates through the PdfTree<TKey, TValue>.

    • C#
    • VB.NET
    public PdfTree<TKey, TValue>.Enumerator GetEnumerator()
    Public Function GetEnumerator As PdfTree(Of TKey, TValue).Enumerator
    Returns
    PdfTree.Enumerator<>

    A PdfTree<TKey, TValue>.Enumerator for the PdfTree<TKey, TValue>.

    Remove(TKey)

    Removes the value with the specified key from the tree.

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

    The key of the entry to remove.

    Returns
    System.Boolean

    true if the key is found and the entry removed; otherwise, false. This method returns false if key is not found in the tree.

    Exceptions
    System.ArgumentNullException

    key is null.

    TryGetValue(TKey, out TValue)

    Gets the value associated with the specified key.

    • C#
    • VB.NET
    public bool TryGetValue(TKey key, out TValue value)
    Public Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
    Parameters
    key
    TKey

    The key of the value to get.

    value
    TValue

    When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.

    Returns
    System.Boolean

    true if the tree contains an entry with the specified key; otherwise, false.

    Exceptions
    System.ArgumentNullException

    key is null.

    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.9.6 Name Trees'
    PDF Specification ISO 32000-1:2008, section '7.9.7 Number Trees'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.