Git Product home page Git Product logo

Comments (4)

NightWhistler avatar NightWhistler commented on September 3, 2024

The short answer is: by processing the text and cutting it into page-sized chunks.

Longer answer: this means you cannot directly display the text in a webview, but you have to process it first.

from epublib.

ritika-mittal avatar ritika-mittal commented on September 3, 2024

By processing the text do you mean that i need to parse the whole xhtml spine and setting spans for each tag??

from epublib.

NightWhistler avatar NightWhistler commented on September 3, 2024

From your comments on another issue I understand you're using HtmlSpanner now.

This means you should already have a Spanned text, so now all you have to do is to take the right sub-string to leave you with exactly one page of text. My solution was to use a StaticLayout to measure how much text fits on the screen, and then put that sub-string in the TextView.

Take a look at this code to see what I mean, but be careful: it's GPL licenced:
https://github.com/NightWhistler/PageTurner/blob/master/src/main/java/net/nightwhistler/pageturner/view/SinglePageStrategy.java

from epublib.

RioTech avatar RioTech commented on September 3, 2024

Hi,

I am also using staticLayout. But, My layout.getLineStart(topLine); and layout.getLineEnd(bottomLine) not working properly. It's giving topLine number+1 and bottomLine number +1 value :( I Have tried/searched lot but no luck. Could you please help me on this regard.

from epublib.

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.