PdfOutlineCollection Class

The items of a level of the document outline (ISO 32000-2, 12.3.3).

Remarks

The outline of a file is read when it is first accessed; a save writes it back: the links between the items are rewritten, and the other properties of an item read from the file only when they were changed.

An item is in one collection at most, once: adding an item that is already in a collection, or that contains the collection, throws InvalidOperationException. Remove it from its collection first.

Implements

Properties

NameDescription
CountGets the number of items.
System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.PdfOutlineItem>.IsReadOnly

Gets the number of items.

public int Count { get; }

Property value

int

System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.PdfOutlineItem>.IsReadOnly

PdfOutlineCollection.cs
bool ICollection<PdfOutlineItem>.IsReadOnly { get; }

Property value

bool

No documentation is available.

Indexers

NameDescription
this[int]Gets or sets an item.

Gets or sets an item.

public PdfOutlineItem this[int index] { get; set; }

Parameters

index int
The index.

Property value

PdfOutlineItem

Methods

NameDescription
Add(PdfOutlineItem)Adds an item to the ICollection<T>.
Add(string, PdfDestination?)Adds an item.
Clear()Removes all items from the ICollection<T>.
Contains(PdfOutlineItem)Determines whether the ICollection<T> contains a specific value.
CopyTo(PdfOutlineItem[], int)Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
GetEnumerator()Returns an enumerator that iterates through the collection.
IndexOf(PdfOutlineItem)Determines the index of a specific item in the IList<T>.
Insert(int, PdfOutlineItem)Inserts an item to the IList<T> at the specified index.
Remove(PdfOutlineItem)Removes the first occurrence of a specific object from the ICollection<T>.
RemoveAt(int)Removes the IList<T> item at the specified index.
System.Collections.IEnumerable.GetEnumerator()

Add overloads

Add(PdfOutlineItem)

PdfOutlineCollection.cs

Adds an item to the ICollection<T>.

public void Add(PdfOutlineItem item)
Parameters
item PdfOutlineItem
The object to add to the ICollection<T>.
Exceptions
InvalidOperationException
The item is already in a collection, or it contains this collection.

Add(string, PdfDestination?)

PdfOutlineCollection.cs

Adds an item.

public PdfOutlineItem Add(string title, PdfDestination? destination = null)
Parameters
title string
The text of the item.
destination PdfDestination?
The destination, or null.
Returns

PdfOutlineItem The new item.

Removes all items from the ICollection<T>.

public void Clear()

Exceptions

NotSupportedException
The ICollection<T> is read-only.

Contains(PdfOutlineItem)

PdfOutlineCollection.cs

Determines whether the ICollection<T> contains a specific value.

public bool Contains(PdfOutlineItem item)

Parameters

item PdfOutlineItem
The object to locate in the ICollection<T>.

Returns

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

CopyTo(PdfOutlineItem[], int)

PdfOutlineCollection.cs

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

public void CopyTo(PdfOutlineItem[] array, int arrayIndex)

Parameters

array PdfOutlineItem[]
The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex int
The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException
array is null.
ArgumentOutOfRangeException
arrayIndex is less than 0.
ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

Returns an enumerator that iterates through the collection.

public IEnumerator<PdfOutlineItem> GetEnumerator()

Returns

IEnumerator<PdfOutlineItem> An enumerator that can be used to iterate through the collection.

IndexOf(PdfOutlineItem)

PdfOutlineCollection.cs

Determines the index of a specific item in the IList<T>.

public int IndexOf(PdfOutlineItem item)

Parameters

item PdfOutlineItem
The object to locate in the IList<T>.

Returns

int The index of item if found in the list; otherwise, -1.

Insert(int, PdfOutlineItem)

PdfOutlineCollection.cs

Inserts an item to the IList<T> at the specified index.

public void Insert(int index, PdfOutlineItem item)

Parameters

index int
The zero-based index at which item should be inserted.
item PdfOutlineItem
The object to insert into the IList<T>.

Exceptions

InvalidOperationException
The item is already in a collection, or it contains this collection.

Remove(PdfOutlineItem)

PdfOutlineCollection.cs

Removes the first occurrence of a specific object from the ICollection<T>.

public bool Remove(PdfOutlineItem item)

Parameters

item PdfOutlineItem
The object to remove from the ICollection<T>.

Returns

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

Exceptions

NotSupportedException
The ICollection<T> is read-only.

Removes the IList<T> item at the specified index.

public void RemoveAt(int index)

Parameters

index int
The zero-based index of the item to remove.

Exceptions

ArgumentOutOfRangeException
index is not a valid index in the IList<T>.
NotSupportedException
The IList<T> is read-only.

System.Collections.IEnumerable.GetEnumerator()

PdfOutlineCollection.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.