---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/PageCollection
---

# PageCollection

## Overview

`PageCollection` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `IEnumerable`.

Collection of pages in a PDF document.

This class provides 29 methods for working with PageCollection objects in .NET programs.
Available methods include: `Accept`, `Add`, `At`, `BeginUpdate`, `Clear`, `Contains`, `CopyTo`, `Delete`, `EndUpdate`, `Flatten`, `FreeMemory`, `GetEnumerator`, and 3 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Count`, `IsReadOnly`, `IsSynchronized`, `SyncRoot`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Count` | `int` | Read | Total number of pages. |
| `IsReadOnly` | `bool` | Read | Whether the collection is read-only. |
| `IsSynchronized` | `bool` | Read | Whether the collection is thread-safe. |
| `SyncRoot` | `object` | Read | Synchronization root for IsSynchronized; returns this collection. |

## Methods

| Signature | Description |
|-----------|-------------|
| `At(oneBasedIndex: int)` | Alias for indexer — get page by 1-based page number. |
| `IndexOf(entity: Page?)` | Returns the 1-based index of the given page, or -1 if not found. |
| `Accept(visitor: Text.TextAbsorber)` | Accept a TextAbsorber visitor; iterates every page. |
| `Accept(visitor: Text.TextFragmentAbsorber)` | Accept a TextFragmentAbsorber visitor; accumulates fragments across all pages. |
| `Accept(visitor: ImagePlacementAbsorber)` | Accept an ImagePlacementAbsorber visitor across every page. |
| `Accept(visitor: Annotations.AnnotationSelector)` | Walk every annotation on every page and dispatch it to visitor. |
| `Add()` | Add a new blank page. |
| `Add(width: double, height: double)` | Add a new blank page with the given dimensions. |
| `Add(entity: Page)` | Add a page from another (or the same) document by deep-cloning its page dictionary. |
| `Add(otherPages: PageCollection)` | Add all pages from another page collection (cross-document merge). |
| `Add(pages: ICollection)` | Add multiple pages from a collection (cross-document merge). |
| `Add(pages: Page[])` | Add multiple pages from an array (cross-document merge). |
| `Insert(pageNumber: int)` | Insert a new blank page before the given 1-based index. |
| `Insert(pageNumber: int, width: double, height: double)` | Insert a new blank page with explicit dimensions before the given 1-based index. |
| `Delete(index: int)` | Delete a page by 1-based page number. |
| `Delete(pages)` | Delete multiple pages by 1-based page numbers. |
| `Delete()` | Delete all pages from the document. |
| `Insert(pageNumber: int, entity: Page)` | Insert a single page (from any document) before the given 1-based index. |
| `Insert(pageNumber: int, pages: ICollection)` | Insert multiple pages from a collection before the given 1-based index (cross-document merge). |
| `Insert(pageNumber: int, pages: Page[])` | Insert multiple pages from an array before the given 1-based index (cross-document merge). |
| `FreeMemory()` | Clears cached data on every page. |
| `BeginUpdate()` | Suspend page-tree maintenance during a batch of mutations. |
| `EndUpdate()` | Resume page-tree maintenance after a BeginUpdate batch. |
| `Clear()` | Remove every page from the collection. |
| `Contains(item: Page)` | Whether the supplied page belongs to this collection. |
| `CopyTo(array: Page[], index: int)` | Copy the collection contents into an array starting at index. |
| `Flatten()` | Flatten every form and annotation on every page. |
| `Remove(item: Page)` | Remove the supplied page and report whether it was present. |
| `GetEnumerator()` | Calls GetEnumerator on this PageCollection instance. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)