Skip to content

# PDFPageCollection

Namespace: O2S.Components.PDF4NET

Defines a collection of PDF pages.

    public class PDFPageCollection : System.Collections.ObjectModel.Collection`1[[O2S.Components.PDF4NET.PDFPage, O2S.Components.PDF4NET.NetStandard, Version=16.3.0.1, Culture=neutral, PublicKeyToken=80d03dd9e5b85317]]

Inheritance Object → Collection<PDFPage> → PDFPageCollection
Implements

## Properties

### Count

    public int Count { get; }

Property Value

Int32

### Item

    public PDFPage Item { get; set; }

Property Value

PDFPage

## Methods

### Add()

Adds a new page at the end of the collection.

    public PDFPage Add()

Returns

PDFPage
The new page.

### Add(PDFPageSize)

Adds a new page with the specified size at the end of the collection.

    public PDFPage Add(PDFPageSize pageSize)

Parameters

`pageSize` PDFPageSize
The size of the newly created page.

Returns

PDFPage
The new page.

### ConvertListToTree()

Converts the internal pages structure from a list to a tree.

    public void ConvertListToTree()

Remarks

By default the library stores the pages in a single list which can become very large if the document has many pages. Some PDF processors have trouble procesing such long lists, so this method transform the internal pages structure into a tree.
Note: This method should be called only once before the document is saved and only on documents creates from scratch with the library.