Class PdfPagesCollection
Manages the collection of pages within a PDF document. Supports iteration, addition, removal, and direct access to individual pages.
Access this collection via Pages property. The collection provides full control over document structure including page manipulation.
Example - Work with pages:
var pdf = PdfDocument.FromFile("document.pdf");
// Iterate pages:
foreach (var page in pdf.Pages)
Console.WriteLine($"Page {page.PageIndex}: {page.Width}x{page.Height}");
// Access specific page:
var firstPage = pdf.Pages[0];
var lastPage = pdf.Pages[pdf.PageCount - 1];
// Remove page:
pdf.Pages.RemoveAt(2); // Remove page 3
// Get page count:
int totalPages = pdf.Pages.Count;
Inheritance
System.Object
PdfPagesCollection
Implements
IronSoftware.Abstractions.Absolute.IDocumentPageCollection<IPdfPage>
System.Collections.Generic.IReadOnlyCollection<IPdfPage>
System.Collections.Generic.IEnumerable<IPdfPage>
System.Collections.IEnumerable
Namespace: IronPdf.Pages
Assembly: IronPdf.dll
Syntax
public class PdfPagesCollection : ObservableCollection<IPdfPage>, IPdfPageCollection, IDocumentPageCollection<IPdfPage>, IReadOnlyCollection<IPdfPage>, IEnumerable<IPdfPage>, IEnumerable
Remarks
Key Operations:
Page indexes are zero-based (Page 1 = Index 0).
Related Resources:
Methods
Add(PdfPage)
Declaration
public void Add(PdfPage item)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPage | item |
Clear()
Declaration
public void Clear()
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
RefreshPages()
Declaration
public void RefreshPages()
Remove(IPdfPage)
Declaration
public bool Remove(IPdfPage item)
Parameters
| Type | Name | Description |
|---|---|---|
| IPdfPage | item |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Remove(PdfPage)
Declaration
public bool Remove(PdfPage item)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPage | item |
Returns
| Type | Description |
|---|---|
| System.Boolean |
RemoveAt(Int32)
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Implements
IronSoftware.Abstractions.Absolute.IDocumentPageCollection<>
System.Collections.Generic.IReadOnlyCollection<>
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable