Skip to main content
Version: Version 5

Class: PageList

Class for all page-related operations in a PDF document.

Methods

add()

add(page, index)

add(page, index?): Promise<void>

Experimental

Adds a page to the document.

Parameters

page: Page

Page to be added.

index?: number

Page index on which page will be added to the document. If not provided, the default is to add the page at the end of the document.

Returns

Promise<void>

add(pages, index)

add(pages, index?): Promise<void>

Experimental

Adds multiple pages to the document.

Parameters

pages: Page[]

Pages to be added.

index?: number

Page index on which first page in the array will be added. Other pages will be added consecutively after the first one. If not provided, the default is to add the pages at the end of the document.

Returns

Promise<void>


delete()

delete(page)

delete(page): Promise<void>

Experimental

Deletes a single page from the document.

Parameters

page: Page

Returns

Promise<void>

delete(pages)

delete(pages): Promise<void>

Experimental

Deletes multiple pages from the document.

Parameters

pages: Page[]

Returns

Promise<void>


getAll()

getAll(): Page[]

Get an array with all pages in the document.

Returns

Page[]

An array of Page objects representing all pages in the document.


getByIndex()

getByIndex(pageIndex): Page

Get a page by index.

Parameters

pageIndex: number

The index of the page to retrieve.

Returns

Page

The Page object at the specified index.


getByNumber()

getByNumber(pageNumber): Page

Get a page by its page number.

Parameters

pageNumber: number

The page number to search for.

Returns

Page

The Page object with the specified page number, or undefined if not found.


rotate()

rotate(page, options)

rotate(page, options?): Promise<void>

Experimental

Rotates a single page.

Parameters

page: Page

Page to be rotated.

options?

Optional parameters for specifying the rotation angle.

options.absoluteRotation?: number

options.rotation?: number

Returns

Promise<void>

rotate(pages, options)

rotate(pages, options?): Promise<void>

Experimental

Rotates multiple pages.

Parameters

pages: Page[]

An array of pages to be rotated.

options?

Optional parameters for specifying the rotation angle.

options.absoluteRotation?: number

options.rotation?: number

Returns

Promise<void>