05-27-2013, 02:25 PM | #1 |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
What ePub page/position calculation methods are there?
Hey guys,
I'm building an ePub reader, and I need to calculate and display the user's position inside of that ePub. However, ePub section/chapter size/word per page and and styling vary, which makes this a bit more difficult than I'd like. I'm using a web-based solution, and since my implementation is page-oriented, I know what page a user is in, but only inside that section/chapter. Displaying all sections and calculating full number of pages and current page constantly uses too much memory. I was considering simply going with "Chapter X, Page X/X", but then this made me consider what other methods have been employed, or are recommended for letting the user know where they are in a book. Thanks for any advice! Last edited by mattcurtis; 05-31-2013 at 01:33 AM. |
05-28-2013, 01:26 PM | #2 |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Adobe Digital Editions is the most popular reader for ePub. They use 1024 readable characters to determine a page size so no matter what size screen or font size there will be a one to one correspondence to the page number. You can read about this in our wiki and other issues with page numbers.
Dale |
05-29-2013, 03:03 AM | #3 | ||
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Ah, the relevant information is in the wiki: https://wiki.mobileread.com/wiki/Adob...s#Page_numbers Quote:
|
||
05-29-2013, 01:27 PM | #4 | |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
Quote:
|
|
05-30-2013, 02:54 PM | #5 |
Resident Curmudgeon
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Discworld books do not have chapters. So in the case of all of those books, using the term chapter would be incorrect. There also no X/X until the next chapter so that doesn't work as well.
|
05-30-2013, 02:55 PM | #6 |
Resident Curmudgeon
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
05-31-2013, 01:25 AM | #7 | |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
Quote:
Exact ADE style is a bit harder for me to implement at this point, but it's something I have planned out for the future. Last edited by mattcurtis; 05-31-2013 at 01:34 AM. |
|
05-31-2013, 01:37 AM | #8 |
Resident Curmudgeon
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Take a look at the count pages plugin for Calibre. It has the code to do the page count the ADE way and you can then implement it in your program from the start instead of in some update. Best do it that way then similar to Stanza (lousy program).
|
05-31-2013, 03:09 AM | #9 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
And having the relative position inside the current "chapter" is also a very useful feature, at least for the books that have chapters. |
|
05-31-2013, 05:09 PM | #10 |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
I wish it was written in something more accessible than Python
|
05-31-2013, 05:49 PM | #11 |
Resident Curmudgeon
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
05-31-2013, 05:50 PM | #12 |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
And part of my problem is that my reader will allow for extensive CSS customization (well, at least above the norm), and every time the user changes those CSS settings I will have to recalculate the number of pages, and ADE probably won't cut it if it's going to be accurate. I'll have to experiment with how long it takes to get full number of pages in large ePubs, see if that's feasible :/
|
05-31-2013, 06:38 PM | #13 |
Grand Sorcerer
Posts: 12,168
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Actually I wold have thought that with the ADE style of page numbering, no degree of changes to the CSS would affect the page number. After all that is the whole idea behind the synthetic numbering. This is as opposed to the page numbers in (for instance) the Kobo ePub variant which reflects the actual screen count of pages.
|
05-31-2013, 06:53 PM | #14 | |
Book Lover, Dev of Hyphen
Posts: 59
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
|
Quote:
Back to researching. |
|
05-31-2013, 07:05 PM | #15 |
Grand Sorcerer
Posts: 12,168
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
ADE page numbers are constant, regardless of things like font sizes / screen size etc. Roughly speaking, as others have said, they are based on a 1024 character chunk of the text; each 1k is a page.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iPad ePub, CSS : Bug with 'position:relative' property ? | Ereskelios | Apple Devices | 3 | 09-29-2014 07:53 AM |
iPhone ePub won't scroll page-to-page | JohnnyAppleScrip | Apple Devices | 1 | 02-15-2012 02:31 PM |
epub to mobi h1 page breaks not starting on new page | wannabee | Conversion | 4 | 08-02-2011 12:46 AM |
PB360, Position im Buch (CRM EPUB) wird nicht gespeichert | bigfellow | PocketBook | 1 | 07-17-2010 04:13 PM |
ePub not supported < div > position: absolute | samsgates | ePub | 1 | 06-18-2010 11:22 AM |