Click or drag to resize
Pdf Library for .NET

PdfPageCollection Class

Represents the collection of pages in a PDF document. Accessed through Pages; supports indexing, enumeration, and adding, inserting, or removing pages.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfPageCollection

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class PdfPageCollection : IEnumerable<PdfPage>, 
	IEnumerable

The PdfPageCollection type exposes the following members.

Properties
 NameDescription
Public propertyCount Gets the number of pages in the collection.
Public propertyDocument Gets the parent pdf document of the pages collection.
Public propertyItem Gets or sets the page at the specified index.
Top
Methods
 NameDescription
Public methodCode exampleAdd Adds a new page to the document, using the document's default size and margins.
Public methodAdd(PdfMargins)Adds a new page with the specified margins.
Public methodAdd(PdfPage) Adds an existing page (from another document) to this document. The page is imported by content — the source document is not modified and subsequent changes to the source do not affect the imported copy.
Public methodAdd(PdfPage)Adds an array of existing pages (from another document) to this document.
Public methodAdd(PdfCustomPageSize, PdfMargins)Adds a new page with the specified size and margins.
Public methodAdd(PdfCustomPageSize, PdfMargins, PdfPageOrientation)Adds a new page with the specified size, margins, and orientation.
Public methodContains Checks whether the collection contains the specified page.
Public methodGetEnumerator Returns an enumerator that iterates through the page collection.
Public methodIndexOf Returns the zero-based index of the specified page.
Public methodInsert(Int32, PdfPage) Inserts an existing page at the specified index.
Public methodInsert(Int32, PdfCustomPageSize, PdfMargins, PdfPageOrientation) Inserts a new page at the specified index with the given size, margins, and orientation.
Public methodRemove Removes the specified page from the document.
Public methodRemoveAt Removes the page at the specified index.
Top
Example
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
int count = document.Pages.Count;
PdfPage first = document.Pages[0];
document.Close();
See Also