Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the totalpage,not just a chapter's #203

Closed
risechen opened this issue Apr 8, 2018 · 2 comments
Closed

How to get the totalpage,not just a chapter's #203

risechen opened this issue Apr 8, 2018 · 2 comments

Comments

@risechen
Copy link

risechen commented Apr 8, 2018

No description provided.

@ClassWizard
Copy link
Contributor

In fact, I just have did some research by myself. I render each html in background, Then get the total pages. It not a perfect method, but it do work, hardly. I'm still waiting for the official implementation by Readium. I'm glad to have some discussion when they ready to do this.
If you choose my way, there are some thing you should notice.

  1. webView may stop the rendering job at some time. But I don't know the reason.
  2. the timing of html finish loaded, is hard to catch. (Maybe I choose the wrong way, I firstly try KVO of scrollview's contentSize. It sometimes may not much accuracy.)
  3. simply load the html will take much time. Specially when you load some custom fonts.
  4. any font family/size change can make the page change. you should recounting.
  5. you may want to setup a database to save the pages.

@mickael-menu-mantano
Copy link
Contributor

This can be done using the new positionList API.

Basically you can get the current position index from the last broadcasted Locator.locations.position, and the total number of positions is available with Publication.positionList.count.

More information here: readium/architecture#101

@mickael-menu mickael-menu transferred this issue from readium/r2-testapp-swift Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants