PdfOutlineCollection Class
The items of a level of the document outline (ISO 32000-2, 12.3.3).
public sealed class PdfOutlineCollection : ICollection<PdfOutlineItem>, IEnumerable<PdfOutlineItem>, IList<PdfOutlineItem>, IReadOnlyCollection<PdfOutlineItem>, IReadOnlyList<PdfOutlineItem>, IEnumerableRemarks
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
| Name | Description |
|---|---|
| Count | Gets the number of items. |
| System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.PdfOutlineItem>.IsReadOnly |
System.Collections.Generic.ICollection<Meziantou.Framework.Pdf.PdfOutlineItem>.IsReadOnly
PdfOutlineCollection.csIndexers
| Name | Description |
|---|---|
| this[int] | Gets or sets an item. |
this[int]
PdfOutlineCollection.csGets or sets an item.
public PdfOutlineItem this[int index] { get; set; }Methods
| Name | Description |
|---|---|
| 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.csAdds an item to the ICollection<T>.
public void Add(PdfOutlineItem item)Parameters
itemPdfOutlineItem- 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.csAdds an item.
public PdfOutlineItem Add(string title, PdfDestination? destination = null)Parameters
titlestring- The text of the item.
destinationPdfDestination?- The destination, or
null.
Returns
PdfOutlineItem The new item.
Clear()
PdfOutlineCollection.csRemoves all items from the ICollection<T>.
public void Clear()Exceptions
NotSupportedException- The
ICollection<T>is read-only.
Contains(PdfOutlineItem)
PdfOutlineCollection.csDetermines whether the ICollection<T> contains a specific value.
public bool Contains(PdfOutlineItem item)Parameters
itemPdfOutlineItem- 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.csCopies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(PdfOutlineItem[] array, int arrayIndex)Parameters
arrayPdfOutlineItem[]- The one-dimensional
Arraythat is the destination of the elements copied fromICollection<T>. TheArraymust have zero-based indexing. arrayIndexint- The zero-based index in
arrayat which copying begins.
Exceptions
ArgumentNullExceptionarrayisnull.ArgumentOutOfRangeExceptionarrayIndexis less than 0.ArgumentException- The number of elements in the source
ICollection<T>is greater than the available space fromarrayIndexto the end of the destinationarray.
GetEnumerator()
PdfOutlineCollection.csReturns 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.csDetermines the index of a specific item in the IList<T>.
public int IndexOf(PdfOutlineItem item)Parameters
itemPdfOutlineItem- 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.csInserts an item to the IList<T> at the specified index.
public void Insert(int index, PdfOutlineItem item)Parameters
indexint- The zero-based index at which
itemshould be inserted. itemPdfOutlineItem- 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.csRemoves the first occurrence of a specific object from the ICollection<T>.
public bool Remove(PdfOutlineItem item)Parameters
itemPdfOutlineItem- 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.
RemoveAt(int)
PdfOutlineCollection.csRemoves the IList<T> item at the specified index.
Parameters
indexint- The zero-based index of the item to remove.
Exceptions
ArgumentOutOfRangeExceptionindexis not a valid index in theIList<T>.NotSupportedException- The
IList<T>is read-only.