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

    Show / Hide Table of Contents

    PdfPages Class

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

    Represents an intermediate node in a page tree, called a page tree node.

    note

    This class provides a flattened view of all descendant PdfPages by implementing the System.Collections.Generic.IList<T> interface.

    • C#
    • VB.NET
    public sealed class PdfPages : PdfPageObject, IList<PdfPage>, ICollection<PdfPage>, IEnumerable<PdfPage>, IEnumerable
    Public NotInheritable Class PdfPages
        Inherits PdfPageObject
        Implements IList(Of PdfPage), ICollection(Of PdfPage), IEnumerable(Of PdfPage), IEnumerable
    Inheritance:
    System.Object
    PdfObject
    PdfPageObject
    PdfPages
    Implements
    System.Collections.Generic.IList<PdfPage>
    System.Collections.Generic.ICollection<PdfPage>
    System.Collections.Generic.IEnumerable<PdfPage>
    System.Collections.IEnumerable

    Properties

    Count

    (Required) The number of leaf nodes (page objects) that are descendants of this node within the page tree.

    • C#
    • VB.NET
    public int Count { get; }
    Public ReadOnly Property Count As Integer
    Property Value
    System.Int32

    The number of leaf nodes (page objects) that are descendants of this node within the page tree.

    Item[Int32]

    Gets or sets the PdfPage at the specified index.

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

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

    Property Value
    PdfPage

    The PdfPage at the specified index.

    Kids

    (Required) An array of indirect references to the immediate children of this node. The children shall only be page objects or other page tree nodes.

    • C#
    • VB.NET
    public PdfPageObjectCollection Kids { get; }
    Public ReadOnly Property Kids As PdfPageObjectCollection
    Property Value
    PdfPageObjectCollection

    An array of indirect references to the immediate children of this node.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.7.3.2 Page Tree Nodes'

    Methods

    Add()

    Adds a new empty PdfPage to the PdfPages.

    • C#
    • VB.NET
    public PdfPage Add()
    Public Function Add As PdfPage
    Returns
    PdfPage

    The PdfPage added to the PdfPages.

    AddClone(PdfPage)

    Adds the clone of the specified PdfPage to the PdfPages.

    • C#
    • VB.NET
    public PdfPage AddClone(PdfPage source)
    Public Function AddClone(source As PdfPage) As PdfPage
    Parameters
    source
    PdfPage

    The PdfPage whose clone should be added to the PdfPages.

    Returns
    PdfPage

    Clone of the specified PdfPage added to the PdfPages.

    Exceptions
    System.ArgumentNullException

    source is null.

    Clear()

    Removes all PdfPages from the PdfCollection.

    • C#
    • VB.NET
    public void Clear()
    Public Sub Clear

    Contains(PdfPage)

    Determines whether a PdfPage is in the collection.

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

    The PdfPage to locate in the collection.

    Returns
    System.Boolean

    true if item is found in the collection; otherwise, false.

    CopyTo(PdfPage[], Int32)

    Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.

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

    The one-dimensional System.Array that is the destination of the elements copied from collection. 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 PdfPages is greater than the available space from arrayIndex to the end of the destination array.

    GetEnumerator()

    Returns an enumerator that iterates through the collection of PdfPages.

    • C#
    • VB.NET
    public PdfPages.Enumerator GetEnumerator()
    Public Function GetEnumerator As PdfPages.Enumerator
    Returns
    PdfPages.Enumerator

    An enumerator for the collection of PdfPages.

    IndexOf(PdfPage)

    Searches for the specified PdfPage and returns the zero-based index of the first occurrence within the entire collection.

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

    The PdfPage to locate in the collection.

    Returns
    System.Int32

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

    Insert(Int32)

    Adds a new empty PdfPage to the PdfPages at the specified index.

    • C#
    • VB.NET
    public PdfPage Insert(int index)
    Public Function Insert(index As Integer) As PdfPage
    Parameters
    index
    System.Int32

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

    Returns
    PdfPage

    The PdfPage inserted to the PdfPages.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than 0 or greater than Count.

    InsertClone(Int32, PdfPage)

    Inserts the clone of the specified PdfPage to the PdfPages at the specified index.

    • C#
    • VB.NET
    public PdfPage InsertClone(int index, PdfPage source)
    Public Function InsertClone(index As Integer, source As PdfPage) As PdfPage
    Parameters
    index
    System.Int32

    The zero-based index at which clone of the PdfPage should be inserted.

    source
    PdfPage

    The PdfPage whose clone should be inserted to the PdfPages.

    Returns
    PdfPage

    Clone of the specified PdfPage inserted to the PdfPages.

    Exceptions
    System.ArgumentNullException

    source is null.

    Move(Int32, Int32)

    Moves the PdfPage at the specified index to a new location in the collection.

    • C#
    • VB.NET
    public void Move(int oldIndex, int newIndex)
    Public Sub Move(oldIndex As Integer, newIndex As Integer)
    Parameters
    oldIndex
    System.Int32

    The zero-based index specifying the location of the PdfPage to be moved.

    newIndex
    System.Int32

    The zero-based index specifying the new location of the PdfPage.

    Remove(PdfPage)

    Removes the first occurrence of a specific PdfPage from the collection.

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

    The PdfPage to remove from the collection.

    Returns
    System.Boolean

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

    RemoveAt(Int32)

    Removes the PdfPage at the specified index of the collection.

    • C#
    • VB.NET
    public void RemoveAt(int index)
    Public Sub RemoveAt(index As Integer)
    Parameters
    index
    System.Int32

    The zero-based index of the PdfPage to remove.

    Inherited Properties

    CropBox

    (Optional; inheritable) A rectangle, expressed in default user space units, that shall define the visible region of default user space.

    When the page is displayed or printed, its contents shall be clipped (cropped) to this rectangle and then shall be imposed on the output medium in some implementation-defined manner (see 14.11.2, "Page Boundaries").

    Default value: the value of MediaBox.

    Value of this property might be null if this is an instance of a PdfPages, but it should never be null if this is an instance of a PdfPage.

    (Inherited from PdfPageObject)

    MediaBox

    (Required; inheritable) A rectangle (see 7.9.5, "Rectangles"), expressed in default user space units, that shall define the boundaries of the physical medium on which the page shall be displayed or printed (see 14.11.2, "Page Boundaries").

    Value of this property might be null if this is an instance of a PdfPages, but it should never be null if this is an instance of a PdfPage.

    (Inherited from PdfPageObject)

    Metadata

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

    (Inherited from PdfObject)

    Parent

    (Required except in root node; prohibited in the root node; shall be an indirect reference) The page tree node that is the immediate parent of this one.

    (Inherited from PdfPageObject)

    Rotate

    (Optional; inheritable) The number of degrees by which the page shall be rotated clockwise when displayed or printed.

    The value shall be a multiple of 90.

    Default value: 0.

    (Inherited from PdfPageObject)

    Inherited Methods

    SetCropBox(System.Double, System.Double)

    Sets the CropBox.

    (Inherited from PdfPageObject)

    SetCropBox(System.Double, System.Double, System.Double, System.Double)

    Sets the CropBox.

    (Inherited from PdfPageObject)

    SetMediaBox(System.Double, System.Double)

    Sets the MediaBox.

    (Inherited from PdfPageObject)

    SetMediaBox(System.Double, System.Double, System.Double, System.Double)

    Sets the MediaBox.

    (Inherited from PdfPageObject)

    Implements

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

    Extension Methods

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

    Examples

    Page Tree example

    See Also

    PDF Specification ISO 32000-1:2008, section '7.7.3.2 Page Tree Nodes'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.