Paul Reiners
Paul Reiners

Reputation: 7894

pdf.js: Changing current page number programmatically

With pdf.js is there a way to programmatically change the current page of a PDF being viewed? For example, a call to change the current page to page 5.

(I know that I can initially set the page by specifying the page number in the URL, but I want to change it programmatically after it has been opened.)

Upvotes: 7

Views: 6347

Answers (1)

Rob W
Rob W

Reputation: 349192

PDFViewerApplication.pdfViewer.currentPageNumber is a getter and setter. Examples:

// Go to page 5
PDFViewerApplication.pdfViewer.currentPageNumber = 5;

// Move two pages forward
PDFViewerApplication.pdfViewer.currentPageNumber += 2;

Upvotes: 10

Related Questions