Skip to main content
Version: Version 5

Class: PageList

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

Implements​

Methods​

add()​

Call Signature​

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>

Call Signature​

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()​

Call Signature​

delete(page): Promise<void>

Experimental

Deletes a single page from the document.

Parameters​
page​

Page

The page to be deleted.

Returns​

Promise<void>

Call Signature​

delete(pages): Promise<void>

Experimental

Deletes multiple pages from the document.

Parameters​
pages​

Page[]

An array of pages to be deleted.

Returns​

Promise<void>


dispose()​

dispose(): void

Disposes of the object, releasing any resources it holds.

The dispose method is responsible for performing cleanup operations and releasing any resources acquired by the object. Once an object is disposed, it should not be used, and attempts to do so may result in undefined behavior.

Returns​

void

Implementation of​

Disposable.dispose


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()​

Call Signature​

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.

absoluteRotation​

number

rotation​

number

Returns​

Promise<void>

Call Signature​

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.

absoluteRotation​

number

rotation​

number

Returns​

Promise<void>