Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pdf.js: Changing current page number programmatically

Tags:

pdf.js

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.)

like image 574
Paul Reiners Avatar asked Mar 15 '23 07:03

Paul Reiners


1 Answers

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;
like image 163
Rob W Avatar answered May 13 '23 04:05

Rob W