-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Tips and Tricks
Patrick G edited this page Nov 24, 2016
·
10 revisions
To use pagination, first you have to generate the page numbers. This will return a promise which completes after the pagination is generated:
book.generatePagination().then(function () {
console.log("The pagination has been generated");
});
To have pagination consistent across different window sizes, you can specify a fixed size in pixels for each page:
var width = 600;
var height = 600;
book.generatePagination(width, height).then(function () {
console.log("The pagination has been generated");
});
To get the page number of a CFI:
book.pagination.pageFromCfi(cfiGoesHere);
/* This returns a page number as an Integer */
To get the current page:
book.pagination.pageFromCfi(book.getCurrentLocationCfi());
/* This returns a page number as an Integer */