This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/editors/pdf/pages/pdf-page-collection.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PdfPageCollection

Represents a collection of pages in a PDF document. Provides indexed access to individual objects and methods to manipulate the page structure.

from nutrient_sdk import PdfPageCollection

Construction

PdfPageCollection cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.

Methods

add

def add(self) -> PdfPage
def add(self, width: float, height: float) -> PdfPage
def add(self, page_size: PdfPageSizes) -> PdfPage

Adds a new page at the end of the document with the default A4 page size.

Parameters:

NameTypeDescription
width (optional)floatWidth of the new page in points.
height (optional)floatHeight of the new page in points.
page_size (optional)PdfPageSizesThe predefined page size.

Returns: PdfPage - The newly created . Raises:


get_page

def get_page(self, page_number: int) -> PdfPage

Returns a page by its 1-based page number.

Parameters:

NameTypeDescription
page_numberintThe 1-based page number.

Returns: PdfPage - The with the specified page number. Raises:


insert

def insert(self, index: int) -> PdfPage
def insert(self, index: int, width: float, height: float) -> PdfPage
def insert(self, index: int, page_size: PdfPageSizes) -> PdfPage

Inserts a new page at the specified position with the default A4 page size.

Parameters:

NameTypeDescription
indexintThe 0-based index at which to insert the new page.
width (optional)floatWidth of the new page in points.
height (optional)floatHeight of the new page in points.
page_size (optional)PdfPageSizesThe predefined page size.

Returns: PdfPage - The newly created . Raises:


move_to

def move_to(self, source_index: int, destination_index: int) -> None

Moves a page from one position to another.

Parameters:

NameTypeDescription
source_indexintThe 0-based index of the page to move.
destination_indexintThe 0-based index of the destination position.

Raises:


remove_at

def remove_at(self, index: int) -> None

Removes the page at the specified 0-based index.

Parameters:

NameTypeDescription
indexintThe 0-based index of the page to remove.

Raises:


swap

def swap(self, index1: int, index2: int) -> None

Swaps two pages in the document.

Parameters:

NameTypeDescription
index1intThe 0-based index of the first page.
index2intThe 0-based index of the second page.

Raises:


Properties

count

@property
def count(self) -> int

The number of pages in the collection.

Type: int

Read-only property.


enumerator

@property
def enumerator(self) -> IEnumerator`1

Returns an enumerator that iterates through the pages collection.

Type: IEnumerator1`

Read-only property.


first

@property
def first(self) -> PdfPage

The first page of the document, or null if the document has no pages.

Type: PdfPage

Read-only property.


last

@property
def last(self) -> PdfPage

The last page of the document, or null if the document has no pages.

Type: PdfPage

Read-only property.