Android EPUBLIB read/load content
Asked Answered
A

2

10

I'm playing with http://www.siegmann.nl/epublib on Android. Can someone please explain the right way to

  • read epub HTML content,
  • how to show this on Android (using WebView?),
  • how to split content into pages and
  • how to search the content.

Thx 10x.

Amputate answered 12/8, 2011 at 9:34 Comment(1)
Have you found a viable solution?Brathwaite
A
7

Answers #2:

  1. Extract epub on file system /mnt/sdcard/epub/
  2. Loading values in webview
protected void onCreate(Bundle savedInstanceState) { 
    setContentView(R.layout.epub_reader);
    webView = (WebView) findViewById(R.id.webview);
    Book book = (new EpubReader()).readEpub(new FileInputStream(filename);
    String baseUrl="file://mnt/sdcard/epub/OEBPS/"
    String data = new String(book.getContents().get(2).getData());
    webView.loadDataWithBaseURL(baseUrl, data, "text/html", "UTF-8", null);
}
Adelaadelaida answered 21/9, 2011 at 12:56 Comment(1)
How to display images without extracting?Shoa
T
5

Regarding your questions:

How to read epub HTML content

I'm not sure what you mean. Do you want all the content? Or something specific? All the content can be retrieved using Book.getContent().

how to show this on Android (using WebView?),

I would use WebView for this. Haven't tried that myself though.

how to split content into pages

This I don't know what would work best.

how to search the content.

The nl.siegmann.epublib.search package in epublib-tools has code for a simple search functionality.

Thermocline answered 14/8, 2011 at 19:2 Comment(1)
can you provide the library link for search content.Encrimson

© 2022 - 2024 — McMap. All rights reserved.