Giter VIP home page Giter VIP logo

Comments (4)

nhutnguyen1988 avatar nhutnguyen1988 commented on August 17, 2024

me too, can't figure out how to get current page
need a props type to show/hide page number

from epubjs-rn.

fchasen avatar fchasen commented on August 17, 2024

You can get the current page by passing a function to the onLocationChange property.

It will return an object with the CFI, location in the book and the percentage complete.

from epubjs-rn.

imarem avatar imarem commented on August 17, 2024

Hi @fchasen ,

On the onLocationChange event, I only get (for example) this params:

end:{
  cfi:"epubcfi(/6/6[chapter-1]!/4/2/122/1:2)",
  displayed:{page: 5, totalPages: 6},
  href:"chapter-1.xhtml",
  index:2,
  location:13,
  percentage:1},
start:{
  cfi:"epubcfi(/6/6[chapter-1]!/4/2/112/1:308)",
  displayed:{page: 5, total: 6},
  href:"chapter-1.xhtml",
  index:2,
  location:10,
  percentage:0.7692307692307693}

How can I get the currentpage from the start field's CFI?

This futurepress/epub.js/wiki/Tips-and-Tricks talks about how to get the current page. Are you generate pagination for this purpose or is there any alternative to get the current page?

Thanks in advance.

from epubjs-rn.

fchasen avatar fchasen commented on August 17, 2024

Location is equivalent to a kindle / adobe page location, otherwise if you want the rendered paged you can use the displayed pages to show what page you are in for that chapter.

Generate pagination shouldn't be used on the client as it has to render the entire book.

from epubjs-rn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.