| 
			
			 | 
		#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 02:33 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#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  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | ||
| 
			
			
			
			 frumious Bandersnatch 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570 
				Karma: 20150435 
				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: 
	
  | 
||
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | |
| 
			
			
			
			 Book Lover, Dev of Hyphen 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 59 
				Karma: 2013886 
				Join Date: Apr 2013 
				
				
				
				Device: iPhone (Hyphen) 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
   I've decided to go with percents.
		 | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				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.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	|
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#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 02:34 AM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				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).
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | |
| 
			
			
			
			 frumious Bandersnatch 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570 
				Karma: 20150435 
				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.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | |
| 
			
			
			
			 Book Lover, Dev of Hyphen 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 59 
				Karma: 2013886 
				Join Date: Apr 2013 
				
				
				
				Device: iPhone (Hyphen) 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  
		 | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	|
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#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 :/
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,698 
				Karma: 79983758 
				Join Date: Nov 2007 
				Location: Toronto 
				
				
				Device: Libra H2O, Libra Colour 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			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.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | |
| 
			
			
			
			 Book Lover, Dev of Hyphen 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 59 
				Karma: 2013886 
				Join Date: Apr 2013 
				
				
				
				Device: iPhone (Hyphen) 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Back to researching.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,698 
				Karma: 79983758 
				Join Date: Nov 2007 
				Location: Toronto 
				
				
				Device: Libra H2O, Libra Colour 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			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 08:53 AM | 
| iPhone ePub won't scroll page-to-page | JohnnyAppleScrip | Apple Devices | 1 | 02-15-2012 03:31 PM | 
| epub to mobi h1 page breaks not starting on new page | wannabee | Conversion | 4 | 08-02-2011 01:46 AM | 
| PB360, Position im Buch (CRM EPUB) wird nicht gespeichert | bigfellow | PocketBook | 1 | 07-17-2010 05:13 PM | 
| ePub not supported < div > position: absolute | samsgates | ePub | 1 | 06-18-2010 12:22 PM |