Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-27-2013, 02:25 PM   #1
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
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.
mattcurtis is offline   Reply With Quote
Advert
Old 05-28-2013, 01:26 PM   #2
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 10,684
Karma: 11044418
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2
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
DaleDe is offline   Reply With Quote
Old 05-29-2013, 03:03 AM   #3
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,068
Karma: 9562279
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by DaleDe View Post
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.
Not exactly that way. If I remember correctly, it's one page per 1024 bytes in the compressed file (so changing the compression level does change the number of pages), and then the pages are more or less evenly distributed by displayed characters (or maybe just characters, so comments and HTML code would count).

Ah, the relevant information is in the wiki: https://wiki.mobileread.com/wiki/Adob...s#Page_numbers

Quote:
Originally Posted by mattcurtis
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
Well, why not use a percent position? Beware of using the word "chapter", as not all books are split at chapter level, and even when they are the numbering could not match the actual chapter numbering, and that would be confusing.
Jellby is offline   Reply With Quote
Old 05-29-2013, 01:27 PM   #4
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
Quote:
Originally Posted by Jellby View Post
Not exactly that way. If I remember correctly, it's one page per 1024 bytes in the compressed file (so changing the compression level does change the number of pages), and then the pages are more or less evenly distributed by displayed characters (or maybe just characters, so comments and HTML code would count).

Ah, the relevant information is in the wiki: https://wiki.mobileread.com/wiki/Adob...s#Page_numbers



Well, why not use a percent position? Beware of using the word "chapter", as not all books are split at chapter level, and even when they are the numbering could not match the actual chapter numbering, and that would be confusing.
I've decided to go with percents.
mattcurtis is offline   Reply With Quote
Old 05-30-2013, 02:54 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 48,156
Karma: 36908365
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by Jellby View Post
Well, why not use a percent position? Beware of using the word "chapter", as not all books are split at chapter level, and even when they are the numbering could not match the actual chapter numbering, and that would be confusing.
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.
JSWolf is online now   Reply With Quote
Advert
Old 05-30-2013, 02:55 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 48,156
Karma: 36908365
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by mattcurtis View Post
I've decided to go with percents.
% alone is not OK. I'd prefer ADE style page numbers. Both would do very well.
JSWolf is online now   Reply With Quote
Old 05-31-2013, 01:25 AM   #7
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
Quote:
Originally Posted by JSWolf View Post
% alone is not OK. I'd prefer ADE style page numbers. Both would do very well.
I'm using a sort of compromise: inside of a section, you see both where you are inside of its pages, and your overall percent inside of the book. Similar to Stanza.

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.
mattcurtis is offline   Reply With Quote
Old 05-31-2013, 01:37 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 48,156
Karma: 36908365
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
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).
JSWolf is online now   Reply With Quote
Old 05-31-2013, 03:09 AM   #9
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,068
Karma: 9562279
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by JSWolf View Post
% alone is not OK. I'd prefer ADE style page numbers. Both would do very well.
Yes, "pages" would be fine to get an idea of the total length of the book. And it's very easy to calculate the total number of ADE-style pages, so one could have "95.00% of 20 pages" or "1.00% of 1900 pages" (both are "page 19"). Better yet, don't use the word "page", as it's misleading, maybe something like "block".

And having the relative position inside the current "chapter" is also a very useful feature, at least for the books that have chapters.
Jellby is offline   Reply With Quote
Old 05-31-2013, 05:09 PM   #10
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
Quote:
Originally Posted by JSWolf View Post
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).
I wish it was written in something more accessible than Python
mattcurtis is offline   Reply With Quote
Old 05-31-2013, 05:49 PM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 48,156
Karma: 36908365
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by mattcurtis View Post
I wish it was written in something more accessible than Python
You could ask the author for help with how its done to get the same page number as ADE.
JSWolf is online now   Reply With Quote
Old 05-31-2013, 05:50 PM   #12
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
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 :/
mattcurtis is offline   Reply With Quote
Old 05-31-2013, 06:38 PM   #13
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 9,846
Karma: 56938177
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
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.
PeterT is offline   Reply With Quote
Old 05-31-2013, 06:53 PM   #14
mattcurtis
Book Lover, Dev of Hyphen
mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.mattcurtis ought to be getting tired of karma fortunes by now.
 
Posts: 55
Karma: 2013886
Join Date: Apr 2013
Device: iPhone (Hyphen)
Quote:
Originally Posted by PeterT View Post
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.
Your saying that makes me think I don't understand ADE paging fully.

Back to researching.
mattcurtis is offline   Reply With Quote
Old 05-31-2013, 07:05 PM   #15
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 9,846
Karma: 56938177
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
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.
PeterT is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 02:56 PM.


MobileRead.com is a privately owned, operated and funded community.