View Full Version : Kindle Page Numbers


goaspy
02-08-2011, 03:14 AM
The new Kindle Firmware 3.1 (http://www.amazon.com/gp/help/customer/display.html/ref=kcf_sw_31?nodeId=200529700) is able to display page numbers. (http://www.amazon.com/gp/help/customer/display.html/ref=hp_k3softwareupdate_pages?nodeId=200505500&#pages)

Will it be possible to set page numbers from Calibre by converting to MOBI? Maybe similar to the way epub calculates pages. Or import page numbers from epub if this is possible.

HarryT
02-08-2011, 03:47 AM
If you can explain to us what the technical specification of the new page number mechanism is, someone can implement it. Just asking a question such as "is it possible" without specifying what needs to be done isn't going to achieve very much ;).

DoctorOhh
02-08-2011, 04:54 AM
Will it be possible to set page numbers from Calibre by converting to MOBI? Maybe similar to the way epub calculates pages. Or import page numbers from epub if this is possible.

First off it hasn't been released yet so this really isn't a question but a request to predict the future.

My prediction, Since their numbering equates to specific print version the odds that this will be implemented in calibre conversions to mobi is very remote. I don't see Amazon having any reason to supply this data via a API like their metadata. Of course anything is possible.

goaspy
02-08-2011, 04:55 AM
I will investigate as much as I can, Amazon already sells books with page numbers.

sam.doran
02-08-2011, 12:04 PM
From reading on Amazon's site, it looks like the page numbers are linked to an ISBN. Since calibre already has ISBN info for most books (or can acquire it automagically), I imagine it should be fairly simple to implement. I'm far from a programmer, but it looks as though the pieces are all there, it's just a matter of putting an ISBN into the .mobi file.

goaspy
02-08-2011, 12:12 PM
The ISBN doesn't give you the pages, it is mentioned just so you know that page X from your kindle book is the same with page X from that book.

DMSmillie
02-08-2011, 12:17 PM
From reading on Amazon's site, it looks like the page numbers are linked to an ISBN. Since calibre already has ISBN info for most books (or can acquire it automagically), I imagine it should be fairly simple to implement. I'm far from a programmer, but it looks as though the pieces are all there, it's just a matter of putting an ISBN into the .mobi file.

How would the bibliographic data associated with an ISBN create links between pages in the print version and the points in the Kindle version where the page number should be incremented? The ISBN simply identifies the print version that the page numbering is based on.

One possibility is that Amazon might have introduced an implementation of some form of the NCX <pagelist> (http://www.idpf.org/doc_library/epub/OPF_2.0.1_draft.htm#Section2.4.1) coding. But at the moment, that's just a guess.

Manichean
02-08-2011, 01:57 PM
It could be just that they use the fact that the number of screen pages in an ebook and the number of print pages in a paper book scale mostly linearly. Thus, if you know the total number of print pages, and the total number and current number of screen pages, you can easily calculate the current print page. This wouldn't necessarily be 100% exact, though.

goaspy
02-08-2011, 05:01 PM
This looks like a dead end (or not).

The page numbers are not in the book itself, they are in the 'apnx' file. The popular highligts file is the 'phl', and the 'ea' file I don't know what it's for.
If you delete these files from the kindle, the page numbers disappear, along with popular highlights.

The interesting part is that this apnx file works with a certain mobi file.

Update: Even better, the same file works with other mobi files as well, I can jump to page X, but there's nothing special in the mobile file, it's just a converted epub (created manually).
Because this book is smaller than the first one, if I jump to the last page, it displays 100%, Page 318 of 380 (fake numbers but similar).
There are about 18.7 locations per page, confirmed by the difference above.

Piper_
02-08-2011, 05:30 PM
The interesting part is that this apnx file works with a certain mobi file.

Update: Even better, the same file works with other mobi files as well, I can jump to page X, but there's nothing special in the mobile file, it's just a converted epub (created manually).
That's great news. Maybe we could have an apnx file repository. ;)

It would be nice if we could grab the .apnx from Amazon by forging the asin (http://www.mobileread.com/forums/showthread.php?t=113315), but that so far has only allowed synchronizing.

Heck, I couldn't even get the .apnx of some of my older .azw books until I deregistered and registered back into that old account.

So it looks like they only send you page files for the books you have in your archive.

user_none
02-08-2011, 05:34 PM
It sounds like the page number file is a simple mapping of stream location to page number.

Any chance you can send me the mobi and its apnx file so I can get a look at it?

If we can determine the structure of the file we can add support for writing it to the Kindle when using send to device. The only issue is the calculation of what a page is. My first idea would be to use the EPUB character count calculation to provide pseudo page numbers. I dont see how we could provide numbers that correspond to a print book like ons purchased due to lack of proper mapping info.

dwig
02-08-2011, 07:22 PM
...My prediction, Since their numbering equates to specific print version the odds that this will be implemented in calibre conversions to mobi is very remote. I don't see Amazon having any reason to supply this data via a API like their metadata. Of course anything is possible.

True. Without a database that correlates some print version's pages numbers with a particular text string, or some other text attribute, there would be no way for a converter to create the new page numbers, whatever underlying mechanism Amazon is planning to use.

The only dream feature I can think of that might work would be for a super intelligent PDF converter to not only strip headers and footer automagically, but to also read the page numbers in either the header or footer and generate Amazon's new page number tags in the appropriate locations (or build the location to page number data table if that is the mechanism).

user_none
02-08-2011, 09:02 PM
goaspy has sent me a the book and apnx file that he was looking at.

Here's what I've figured out so far:

The file starts with

{"contentGuid":"8d3d16e0","asin":"B002RHGYOA","cdeType":"EBOK","fileRevisionId":"1296868639127"} ) = {"asin":"1906694184","pageMap":"(4,a,1)"}


contentGuid is most likely just a guid used to differentiate the file from others.
The first asin is the amazon asin for the Kindle version of the book. cdeType is a Mobi document type specified as ebook. I haven't played with it much but I'm going to assume this is important. The 3.1 update looks to have a new navigation system for periodicals. Most likely the apnx will have a different meaning (but same format) depending on the cdeType.
fileRevisionId should be obvious.
The second asin is the isbn for the paper back version of the book.
Don't know what pageMap does yet.


Following this header is a list of 4 byte sequences of big endian ints. They are in an increasing order. The total number of the 4 byte sequences is 573. The first 3 ints are all 0 which leads me to believe they are padding. The total number of pages within the book are 570 (as shown on the Kindle itself). I need to do some testing but it looks like my assumption is correct and the apnx file is a list o file locations where each is the beginning of a new page.

user_none
02-09-2011, 09:45 PM
I've reverse engineered the APNX file format. Full specs are in format_docs/pdb/apnx.txt of the calibre source. I've added support to the Kindle interface to write it when sending MOBI files to the Kindle. Pages are mapped the same way EPUB page numbers are using 1024 character blocks. If all goes well Kovid will merge the change and it will be in the next (0.7.45) release.

Thank you to goaspy for helping with with finding test files for me to look at. Your input was helpful too and make the whole process quicker than it would have been.

Piper_
02-09-2011, 10:04 PM
I've reverse engineered the APNX file format. Full specs are in format_docs/pdb/apnx.txt of the calibre source. I've added support to the Kindle interface to write it when sending MOBI files to the Kindle. Pages are mapped the same way EPUB page numbers are using 1024 character blocks. If all goes well Kovid will merge the change and it will be in the next (0.7.45) release.

Thank you to goaspy for helping with with finding test files for me to look at. Your input was helpful too and make the whole process quicker than it would have been.

Wow, that is just awesome! And so fast. I was afraid to hope. lol

Karma on its way. And a little something else for :beer: ;)

DoctorOhh
02-09-2011, 11:08 PM
I've added support to the Kindle interface to write it when sending MOBI files to the Kindle. Pages are mapped the same way EPUB page numbers are using 1024 character blocks.

I think it is great that you have been able to implement these pseudo page numbers similar to epub. It's not what Amazon is advertising but it will be invaluable to Kindle users on this forum. Especially for the user who asked for a way to be able to assign x pages of reading to her home schooled child.

:thumbsup::thumbsup:

goaspy
02-10-2011, 02:41 AM
I've reverse engineered the APNX file format. Full specs are in format_docs/pdb/apnx.txt of the calibre source. I've added support to the Kindle interface to write it when sending MOBI files to the Kindle. Pages are mapped the same way EPUB page numbers are using 1024 character blocks. If all goes well Kovid will merge the change and it will be in the next (0.7.45) release.

Thank you to goaspy for helping with with finding test files for me to look at. Your input was helpful too and make the whole process quicker than it would have been.

Yeah, it was a good day for science :) You are fast!!
Thanks for your help, I can't wait to give it a go.

Cheers.

goaspy
02-10-2011, 07:25 PM
Here is a proof of concept to entertain you until the next version of Calibre gets out.

Many thanks to user_none for figuring the specs out.

Just get the attachment, extract the content, and run the little proggy (Windows only).

http://img24.imageshack.us/img24/6905/apnxgen.jpg

Enter the facts, ISBN (optional), the number of locations (the Kindle will tell you ;)) and the desired number of pages.

Press 'Generate' then look for a file named unknown.apnx in the same location where you keep the executable.

That's it! Rename the file after your mobi/azw file, and transfer it on the Kindle (or in 'My Kindle Content' folder in documents for Kindle4PC).

Enjoy!

JSWolf
02-10-2011, 07:27 PM
The ISBN doesn't give you the pages, it is mentioned just so you know that page X from your kindle book is the same with page X from that book.

But it's not the same. I looked as the sample Amazon showed and I think it's like x44 for the Kindle version with the pBook being x52. Close, but not close enough.

DMSmillie
02-10-2011, 08:08 PM
But it's not the same. I looked as the sample Amazon showed and I think it's like x44 for the Kindle version with the pBook being x52. Close, but not close enough.

What sample are you referring to, JSWolf?

user_none
02-10-2011, 08:12 PM
But it's not the same. I looked as the sample Amazon showed and I think it's like x44 for the Kindle version with the pBook being x52. Close, but not close enough.

The mapping is the same. However, it only maps to pages with actual page number. The copyright, dedication, table of contents pages will be excluded if they are not numbered.

The Girl Who Played with Fire by Stieg Larsson for instance shows a different page total between the Kindle and Print version however every numbered page maps 1 to 1 between the two.

Piper_
02-11-2011, 12:52 AM
Here is a proof of concept to entertain you until the next version of Calibre gets out.

Many thanks to user_none for figuring the specs out.

Just get the attachment, extract the content, and run the little proggy (Windows only).

Enter the facts, ISBN (optional), the number of locations (the Kindle will tell you ;)) and the desired number of pages.

Press 'Generate' then look for a file named unknown.apnx in the same location where you keep the executable.

That's it! Rename the file after you mobi/azw file, and copy it on the kindle.

Enjoy!
Cool!
Thank you, goaspy! :thumbsup::thumbsup::thumbsup:

silasgreenback
02-11-2011, 07:17 AM
Here is a proof of concept to entertain you until the next version of Calibre gets out.

Many thanks to user_none for figuring the specs out.

That's it! Rename the file after your mobi/azw file, and transfer it on the Kindle.

Enjoy!

Big thanks to user_none and thanks to you for posting it! :thumbsup:

It should be noted that for it to work, the extension .apnx needs to remain at the end of the file.

Having both the page numbers and locations is the bee's knees.

Jellby
02-11-2011, 02:49 PM
Pages are mapped the same way EPUB page numbers are using 1024 character blocks.

You're aware they are not "EPUB" page numbers, but "Adobe" page numbers, of course, and they are not exactly 1024 character blocks


If I remember correctly, the number of pages per file is computed by dividing the compressed size of the file by 1024. Page boundaries are then distributed evenly in the file.

user_none
02-11-2011, 03:32 PM
You're aware they are not "EPUB" page numbers, but "Adobe" page numbers, of course, and they are not exactly 1024 character blocks

Nope and nope. EPUB is not my area of expertise. I wasn't able to find a spec for computing page numbers so I went from memory about how I thought it worked.

I'm using 1024 blocks of uncompressed text. Since it's an arbitrary calculation it can always be tweaked. I'll look over the ebook docs on Adobe's website and see about getting it working using the same calculation.

kovidgoyal
02-11-2011, 03:34 PM
You wont find it easy to use the same calculation as the compression algorithms for MOBI and EPUB are different.

Jellby
02-11-2011, 03:55 PM
Last time I went to check, it seemed the Adobe document was offline. Also, because the pages are computed from the compressed size, it gives a different number if you change the zip compression level when creating the epub :rolleyes:

I found a description here (http://bookclubs.barnesandnoble.com/t5/NOOKbook-Discussion/EPUBs-and-page-numbering/m-p/692216).

Since the Adobe page numbers are rather arbitrary and unpredictable, I would advise using any "reasonable" way to computing pseudo-page numbers you can think of, instead trying to replicate Adobe's.

Piper_
02-11-2011, 04:38 PM
I would advise using any "reasonable" way to computing pseudo-page numbers you can think of, instead trying to replicate Adobe's.


What are the issues preventing a count of presented text only - skipping the source?

user_none
02-11-2011, 05:57 PM
What are the issues preventing a count of presented text only

That would require the entire document to be uncompressed. This takes time and processing power. I'm sure this is why Adobe is using the compressed size. It's easily accessible.

MOBI has a field that stores the uncompressed size in it's header. It's easy and quick to accesss.

What I think I'm going to do is count the number of characters in an average paperback page. Then I'll tweak the 1024 number to match the count minus the average markup per page.

Piper_
02-11-2011, 06:27 PM
Thanks, User. :2thumbsup

Either way, counting the source code in these larger chunks is going to be a lot better for most people than restraining them to 128 byte markers.

It's like aiming for the right foot rather than the right inch. ;) More meaningful to humans and, best of all, gives cushion for bumps in the road.

I long for a day we can have a standard tracking method for all ebook formats.
...and the world to be filled with rainbows and puppy breath... ;)

DoctorOhh
02-11-2011, 10:15 PM
Nope and nope. EPUB is not my area of expertise. I wasn't able to find a spec for computing page numbers so I went from memory about how I thought it worked.

I'm using 1024 blocks of uncompressed text. Since it's an arbitrary calculation it can always be tweaked. I'll look over the ebook docs on Adobe's website and see about getting it working using the same calculation.

I just posted on Adobe's page numbering here (http://www.mobileread.com/forums/showpost.php?p=1387530&postcount=12) with links to appropriate pages.

chyron8472
02-12-2011, 12:40 AM
I wish this was available for K2. =\

Bratzzo
02-12-2011, 09:08 AM
Hi,

I've reverse engineered the APNX file format. Full specs are in format_docs/pdb/apnx.txt of the calibre source. I've added support to the Kindle interface to write it when sending MOBI files to the Kindle. Pages are mapped the same way EPUB page numbers are using 1024 character blocks. If all goes well Kovid will merge the change and it will be in the next (0.7.45) release.



Thanks to you and Kovid for the fast implementation.

But I have one question:
Is it possible not to send the apnx file automaticly to the Kindle?
Because I figured out, that all pagenumbers from my books wich I have tested are way to high!

For example:
print version: 416 pages
ADE: 282 pages
Kindle: 813 pages

Or an other book:
print version: 864 pages
ADE: 646 pages
Kindle: 2193 pages

In this case, I prefer the locatin numbers only.
Therefore I would like that the apnx file will not be transferred automaticly.
OK, I can delete the file by myself. But I would prefer, if there is an option to choose between to send or not to send.



Bratzzo

DoctorOhh
02-12-2011, 09:37 AM
Is it possible not to send the apnx file automaticly to the Kindle? Because I figured out, that all pagenumbers from my books wich I have tested are way to high!

It's possible, but why? It makes much more sense to just adjust the calculation in calibre to give a more realistic number.

For example:
print version: 416 pages
ADE: 282 pages
Kindle: 813 pages

Or an other book:
print version: 864 pages
ADE: 646 pages
Kindle: 2193 pages

Good info this will give the developers something to go on. :thumbsup::thumbsup:

goaspy
02-12-2011, 09:58 AM
Because I figured out, that all pagenumbers from my books wich I have tested are way to high!

For example:
print version: 416 pages
ADE: 282 pages
Kindle: 813 pages

Or an other book:
print version: 864 pages
ADE: 646 pages
Kindle: 2193 pages


You can use ApnxGen in meantime, and override the apnx file generated by Calibre with your custom file.

user_none
02-12-2011, 10:02 AM
The location number is still shown in addition to the page number from the apnx file. Having the apnx doesn't prevent you from seeing the location number.

lyric
02-12-2011, 10:32 AM
Hi all,

I have also noticed that the current page counting algorithm overestimates the number of pages. In the example I have checked a 464-page book is coming out as 980, so it seems that we are around a factor of 2 out.

Cheers,

Dan

user_none
02-12-2011, 10:47 AM
I've tweaked the character count for estimating a page. It about doubles the number of characters per page. I've changed it from 1024 to 2300. This takes into account the average number of characters in a page in my test book and gives some overhead for markup.

Please remember this is never going to be 1 to 1 in a paper back book. In some cases it will be more and some cases it will be less. We are estimating page length based on the number of characters because we cannot take the time to decompress and parse the text.

The disadvantage of using a character count is pages with short (dialog) will create longer pages then long paragraphs. Making the page count shorter than the paper back.

A better but much more resource intensive and slower method to calculate the page length would be to parse the uncompressed text. For each paragraph we would want to find how many lines it would occupy in a paper back book. 70 characters per line and 32 lines per page. So divide the number of characters (minus markup) in each paragraph by 70. If there are less than 70 characters in the paragraph then it is 1 line. Then, count every 32 lines and mark that location as a page.

However, I'm not going to use the better method because it will take a lot of resources and too much time processing for such a feature. Sending to device should take seconds not minutes. If someone (goaspy) wants to make an external tool that will generate pages based on the above method, that would be your best bet for getting almost 1 to 1 page numbers.

Perkin
02-12-2011, 11:46 AM
I had an idea, don't know if it's feasible or not...

What if the source has <a id="calibrekindlepage###" />, that the creator can insert for the 'pages', could calibre identify them an use them rather than calculating the positions.

Would allow for exact 1:1 match to paper book.
Might take too long to loop through getting positions.

Just an idea.

user_none
02-12-2011, 11:58 AM
What if the source has <a id="calibrekindlepage###" />, that the creator can insert for the 'pages', could calibre identify them an use them rather than calculating the positions.

The biggest issue with this is still decompression and parsing which I would like to avoid. I would also like to avoid adding calibre specific markup. It would be better to have a user generated mapping using a standalone tool for cases where the user wants to manually create a 1 to 1 mapping.

I'm going to run some tests with decompression and parsing. If the added time it takes to do this isn't obscene I'll look into making it an option. Fast or accurate pseudo page numbers for instance.

GRiker
02-12-2011, 12:09 PM
I'm going to run some tests with decompression and parsing. If the added time it takes to do this isn't obscene I'll look into making it an option. Fast or accurate pseudo page numbers for instance.

If the decompression test works out favorably, you might look at this enhancement request (http://bugs.calibre-ebook.com/ticket/6913) at the same time.

G

kovidgoyal
02-12-2011, 12:44 PM
@user_none: You can have the MOBI output plugin do the calculation for you and embed the result in some unused MOBI EXTH header for the driver to use. For non calibre generated MOBI files, it can fall back to a default, fast algorithm.

user_none
02-12-2011, 01:28 PM
Here are my results:

Upload time

Accurate

14 books - 29 sec
5 books - 8 sec
3 books - 5 sec


Fast

14 books - 13 sec
5 books - 6 sec
3 books - 3 sec

Looking at set of 14 books we have approximately double the time to transfer. This is due to decompression and parsing the text. My parser only looks at the amount of visible text. Each page is comprised of 32 lines and each line can have up to 70 characters. A paragraph always starts a new line. The accuracy can be increased by adding support for handling <div class="mbp_pagebreak" /> and <br> tags.

One of my test books (http://www.amazon.com/Magic-Labyrinth-Riverworld-Philip-Farmer/dp/0765326558/ref=tmm_pap_title_0) at page 105 mapped 1 to 1 to the print version. I did not do extensive testing of the other pages. Other books mapped very closely to the print edition.

Over all the more accurate APNX generator gives much closer results. With handling for the two additional elements OCRed texts and ones that use the same type setting as their print counter parts should give nearly 1 to 1 page mappings.

Now for the big question. Is doubling the time it takes to transfer the book to the device worth a more accurate mapping? The mapping will be thrown off if the print book physical dimensions are different than the average paper back size I'm using. So a hard cover, larger or smaller paper back will cause the mapping to be off.

Also, if it is worth the extra time for using the accurate parser would it be worth increasing the time even more by changing the parser to accommodate the two previously mentioned elements and make it even more accurate?

kovidgoyal
02-12-2011, 01:31 PM
I suggest making it an option in the kindle driver and/or putting it into the MOBI output code.

user_none
02-12-2011, 01:48 PM
I suggest making it an option in the kindle driver and/or putting it into the MOBI output code.

I'll go with the option that way it works with user's existing MOBI format books. If the user selects accurate I'll have it fall back to fast if there is DRM on the book.

user_none
02-12-2011, 03:21 PM
@Bratzzo and @chyron8472, You will be able to disable APNX generation in the next release. It will be an option in the Kindle Interface settings.

Also, I've set the default to use the accurate parser. This can be changed in the Kindle interface settings in the next release.

@GRiker, It works and it's not a terribly expensive operation. I will add that ticket to my todo list. It shouldn't be hard to implement and since the user is requesting the data they should be fine with having to wait for it.

bwaldron
02-12-2011, 04:15 PM
@Bratzzo and @chyron8472, You will be able to disable APNX generation in the next release. It will be an option in the Kindle Interface settings.

Thank you!

Piper_
02-12-2011, 04:22 PM
My parser only looks at the amount of visible text. Each page is comprised of 32 lines and each line can have up to 70 characters. A paragraph always starts a new line. The accuracy can be increased by adding support for handling <div class="mbp_pagebreak" /> and <br> tags.

One of my test books (http://www.amazon.com/Magic-Labyrinth-Riverworld-Philip-Farmer/dp/0765326558/ref=tmm_pap_title_0) at page 105 mapped 1 to 1 to the print version. I did not do extensive testing of the other pages. Other books mapped very closely to the print edition.

Over all the more accurate APNX generator gives much closer results. With handling for the two additional elements OCRed texts and ones that use the same type setting as their print counter parts should give nearly 1 to 1 page mappings.
Outstanding. :beer:

Just getting to the "only looks at the amount of visible text" is awesome, all by itself.

Now for the big question. Is doubling the time it takes to transfer the book to the device worth a more accurate mapping? The mapping will be thrown off if the print book physical dimensions are different than the average paper back size I'm using. So a hard cover, larger or smaller paper back will cause the mapping to be off.

Also, if it is worth the extra time for using the accurate parser would it be worth increasing the time even more by changing the parser to accommodate the two previously mentioned elements and make it even more accurate?
It's only a matter of seconds, and just one time, so for me, it's easily worth it. But having the option means you can't lose. No one can!

You're giving the best of all worlds to everyone. :2thumbsup

Bratzzo
02-12-2011, 04:24 PM
Hi,

I suggest making it an option in the kindle driver and/or putting it into the MOBI output code.


@Bratzzo and @chyron8472, You will be able to disable APNX generation in the next release. It will be an option in the Kindle Interface settings.

Also, I've set the default to use the accurate parser. This can be changed in the Kindle interface settings in the next release.


Thanks to both of you!

That sounds great!



Bratzzo

Jellby
02-13-2011, 04:27 AM
The accuracy can be increased by adding support for handling <div class="mbp_pagebreak" /> and <br> tags.

And images, and font size differences, and margins (blank space)... I don't think considering these is worth it, though.

user_none
02-13-2011, 08:32 PM
And images, and font size differences, and margins (blank space)... I don't think considering these is worth it, though.

Forgot about those... I'll add them to my todo list. I think the accurate parser is good enough for now but I plan to pick it up again in the future and make it as accurate as possible.

Also, I want to let everyone know that the Fast parser is going to be used by default. The accurate parser can be set in Preferences, Plugins, Device Interfaces, Kindle 2/3, and check the use accurate parser option. Kovid decided to use the fast parser as the default because HUFF/CDIC compressed file can take upwards of 3 - 5 minutes to decompress. My test files are all PalmDoc compressed which take 3 - 5 seconds to decompress.

DoctorOhh
02-13-2011, 10:15 PM
Also, I want to let everyone know that the Fast parser is going to be used by default.

Good decision.

Thanks for putting in the time on this.

mug2k
02-14-2011, 03:52 PM
So is there an option in calibre to add page numbers to existing epub and mobi files ?. Sorry if my question is stupid but you guys are way too technical for me lol

user_none
02-14-2011, 04:02 PM
So is there an option in calibre to add page numbers to existing epub and mobi files?

EPUB no. The files themselves are not modifed. An extra file is sent with the MOBI file when the book is sent to the Kindle 2 or 3. This extra file specifies the pages inside of the MOBI file and only works in a Kindle.

Zeebra
02-14-2011, 04:19 PM
I have the latest version of Calibre (0.7.45) and I've entered the ISBN information for a .mobi book. Is there a way for me to save the .apnx file to a directory on my computer directly from Calibre as opposed to having it copied when I transfer the book to my Kindle? I can't find an option in Calibre to save that file?

user_none
02-14-2011, 04:42 PM
I have the latest version of Calibre (0.7.45) and I've entered the ISBN information for a .mobi book. Is there a way for me to save the .apnx file to a directory on my computer directly from Calibre as opposed to having it copied when I transfer the book to my Kindle? I can't find an option in Calibre to save that file?

No. And the ISBN doesn't matter because APNX generated by calibre does not map to a print version. The only page mapping infomation to prints edition is not made publically avaliable by Amazon. The only way to get an APNX that maps exactly to aprint edition is to buy the book from Amazon.

Piper_
02-14-2011, 05:41 PM
Amazon will also continue adding .apnx files to books, focusing most heavily on big sellers & non-fiction books that are more likely to require such reference.

I think the method you are using, user_none, is just dandy for the rest, and most important, it seems to be the only way toward a standard for all ebooks.

IOW,
"only looks at visible text.
Each page is comprised of n lines and each line can have up to n characters.
A paragraph always starts a new line.
<div class="mbp_pagebreak" /> = new page

...could become the standardized ebook page* so people could settle in with a feel for weight, and all e-versions would match (closely enough) across all formats, regardless of fonts, margins, etc...

(*Call them pages, locations, blocks, whatever everyone wants to call these chunks that give humans logical points of reference and progress. I just use page since it's simplest as a common metaphor.)

don1011
02-14-2011, 05:57 PM
Why when i mail my book to my kindle, i don't have the page numerotation but i have it if i transfer the book by usb

user_none
02-14-2011, 09:55 PM
Why when i mail my book to my kindle, i don't have the page numerotation but i have it if i transfer the book by usb

The APNX file generation is part of the Kindle Interface. Meaning it will only be created and sent to the Kindle when the using "Send to Device" tool bar (or right click) option. Any other method will not have an APNX.

3rdDegree
02-14-2011, 10:05 PM
I guess my question is well below the technical quality of the above ones. Will Kindle books now be able to operate like iBooks? That is, recalculate pages based on font and text size. Also show number of pages to end of chapter? Obviously this type of page numbering has no bearing on the page numbers from the printed book.

Thanks

DoctorOhh
02-14-2011, 10:12 PM
I guess my question is well below the technical quality of the above ones. Will Kindle books now be able to operate like iBooks? That is, recalculate pages based on font and text size. Also show number of pages to end of chapter?

If I understand you correctly the answer is no. The page numbers generated for the Kindle will be the same regardless of what size font you choose within your reader. IOW, increasing font size on your reader will not change the page numbering.

user_none
02-14-2011, 10:15 PM
I guess my question is well below the technical quality of the above ones.

Questions don't have to be technical I only ask / hope they are well written. Also, preferably not asked multiple times.

Will Kindle books now be able to operate like iBooks? That is, recalculate pages based on font and text size.

No. The page numbers are fixed based on location within the file The font and text size have no bearing the the numbers. The design of the APNX is to provide page numbers that correspond to a printed book's pages. The do not look at or account for the screen size or how much text is visible on the screen at a given time.

Also show number of pages to end of chapter?

No. I don't see a technical way to achieve this either. From what I know about the APNX file this is not a feature.

Obviously this type of page numbering has no bearing on the page numbers from the printed book.

The goal of the APNX is to map to pages in a printed book. So the page numbered X will in the Kindle version will start with the same text as the corresponding print version at page X. No matter the font, text size or screen size.

That said Amazon is the only one with the necessary information to map to a print book. Calibre doesn't have that information so it tries (multiple ways) to make a page roughly the length of what you would have if you printed it the size of a paper back book.

kiwidude
02-14-2011, 10:47 PM
I think it is great that user_none etc has made the effort to add this so quickly, well done.

However unless I am missing something I see the only value this feature has is to give a user a rough mental guide as to how many relative "pages" various books on your device may have.

The only additional value Amazon's implementation of page numbers offers is to researchers/students who want to specify a reference, which of course this Calibre feature could at best only roughly estimate.

What Amazon keep avoiding is reflected in the questions by 3rdDegree and mirror my own desires of a "page turn" number which actually has meaning to the rest of us who read books on the Kindle. I could care less about the number of pages in the printed book. What I do care about is how many more times I have to click the next page button to get to the end of the book, or as 3rdDegree has said the end of the chapter. This "page turn" number should reflect the font sizes etc.

I apologise if I am digressing - of course it is not a Calibre issue nor in any way possible to implement. It is an Amazon/Kindle one. I just find it interesting the approach that Amazon have taken in response to lots of us bleating about what a nonsense "location numbers" were.

DoctorOhh
02-14-2011, 11:02 PM
my own desires of a "page turn" number which actually has meaning to the rest of us who read books on the Kindle.
~~~
What I do care about is how many more times I have to click the next page button to get to the end of the book, or as 3rdDegree has said the end of the chapter. This "page turn" number should reflect the font sizes etc.

This is a feature of LRF files on the Sony devices. When they went to ePub this went away. Having used both, I much prefer to have an estimated number of pages than how many more screens are left till the end of the book. Since I use a larger font because of my older eyes. The difference was huge. the epub would say 450 pages the lrf file would say 3800 more turns or screens. I just could never wrap my head around the 3800 number and my brain hurt less with the 450 page number. But that's just me.

I think Amazon adding a print page number feature is great for students and user_none implementing a pseudo numbering system is also a great benefit for many users who have expressed a desire for such a feature. :thumbsup: :thumbsup:

kiwidude
02-14-2011, 11:14 PM
This is a feature of LRF files on the Sony devices. When they went to ePub this went away. Having used both, I much prefer to have an estimated number of pages than how many more screens are left till the end of the book. Since I use a larger font because of my older eyes. The difference was huge. the epub would say 450 pages the lrf file would say 3800 more turns or screens. I just could never wrap my head around the 3800 number and my brain hurt less with the 450 page number. But that's just me.
Very interesting - I'm very new to ereaders so haven't looked at what the others do in this regard. That Sony didn't make an effort to bring the feature forward clearly says "something" - either people hated it or there are technical issues in implementing it.

I guess you don't know until you try it. From years of paperback reading I have become ingrained of walking the tightrope of "do I finish this book before I go do something" or "can I get to the end of the chapter before I fall asleep". I agree in your case a number like 3800 representing the size of a book would take some wrapping your head around. However knowing I have an end point coming up in 2 pages versus one in 15 can be life or death for not getting yelled at sometimes :)

Zeebra
02-15-2011, 09:00 AM
No. And the ISBN doesn't matter because APNX generated by calibre does not map to a print version. The only page mapping infomation to prints edition is not made publically avaliable by Amazon. The only way to get an APNX that maps exactly to aprint edition is to buy the book from Amazon.

Hm, I understand that you're using your own method to generate the APNX file, but since Calibre is generating the file when you initiate a transfer of the book from your computer to the Kindle, isn't it possible to give the user a button or menu option that says "generate APNX" which will save that file to the harddrive? I don't use Calibre to transfer my books to the Kindle, only to convert other formats to mobi. Just wondering if that's possible.

user_none
02-15-2011, 10:09 AM
... isn't it possible to give the user a button or menu option that says "generate APNX" which will save that file to the harddrive?

Yes it is possible. This type of request, being so niche, would be best implemented as a GUI plugin. I would put a request in the sub forum and see if anyone is interested in creating it.

Zeebra
02-15-2011, 10:14 AM
Yes it is possible. This type of request, being so niche, would be best implemented as a GUI plugin. I would put a request in the sub forum and see if anyone is interested in creating it.

Thanks I've added a post to the "plugin ideas" thread. Thanks for your feedback!

wallcraft
02-15-2011, 04:52 PM
Yes it is possible. This type of request, being so niche, would be best implemented as a GUI plugin. I would put a request in the sub forum and see if anyone is interested in creating it. It might be more popular than you think. Kindle for PC now does page numbers, and I guess write to disk would be the way to manage K4PC via Calibre.

elborak
02-15-2011, 07:35 PM
Not knowing Calibre's internals, how difficult would it be to have it support either Adobe's non-standard page-map extension or NCX/pageList so that actual physical page numbers from an EPUB could be preserved in APNX when converting to MOBI?

DaleDe
02-17-2011, 02:30 PM
Wow this is really cool. Would it be possible to apply the same algorithm for more accurate page numbers to the page map feature that ADE supports for ePUB? You can read about the page map feature in our wiki under ADE.

Dale

kovidgoyal
02-17-2011, 03:11 PM
Wow this is really cool. Would it be possible to apply the same algorithm for more accurate page numbers to the page map feature that ADE supports for ePUB? You can read about the page map feature in our wiki under ADE.

Dale

This algorithms is not directly portable to EPUB. This algorithm relies on specifying a character offset, which works for MOBI, but in EPUB you can only use HTML anchors, not character offsets.

lbik
02-19-2011, 09:33 AM
The Only place where I can see someting with pagenumbers ist the GOTO menu. When I read a book there is no pagenumber on the screen.
Is it right that the pagenumber only appears in the GOTO menu ??

DMSmillie
02-19-2011, 09:51 AM
If the book is one of those that has the page numbers file, you will see the page number when you press the MENU button while reading the book. While the menu is displayed, both page numbers and locations numbers will be displayed just above the progress bar at the bottom of the screen.

In addition, this now applies to location numbers regardless of whether page numbers are present or not - they now only get displayed while the menu is displayed. This appears to be in response to all those who complained that having location numbers visible all the time was too distracting.

user_none
02-19-2011, 10:08 AM
The Only place where I can see someting with pagenumbers ist the GOTO menu. When I read a book there is no pagenumber on the screen.
Is it right that the pagenumber only appears in the GOTO menu ??

You have to have the 3.1 pre-release firmware installed to see page numbers.

Freeballer
02-19-2011, 03:15 PM
I have to ask. I just re-transfered all of my ebooks on kindle, with the new firmware, to get page numbers. Did I just waste alot of time doing so, or is there a better way in the future?

user_none
02-19-2011, 04:17 PM
I have to ask. I just re-transfered all of my ebooks on kindle, with the new firmware, to get page numbers. Did I just waste alot of time doing so, or is there a better way in the future?

That's the only way. But since it's all done you won't have to spend any extra time in the future.

Freeballer
02-19-2011, 04:53 PM
then I have to ask one more stupid question; is there any advantage (for me) of the "more reliable" page number in the newest version?

user_none
02-19-2011, 04:55 PM
then I have to ask one more stupid question; is there any advantage (for me) of the "more reliable" page number in the newest version?

If you want them to be more reliable set the option and re-transfer them. Otherwise no.

otichy
02-19-2011, 07:25 PM
This sounds really great! This is a very important feature in the university environment, as has been noted. Even approximated page count is cool, because when somebody refers me to a page # it is certainly better to be few turns away than trying to calculate the possible position in those huge Amazon numbers ;)

Two things I'd really love to see:
1. As already suggested, giving users the possibility of their own page markup would be great. Especially with extensively used study materials...
2. When converting from a OCRed/original PDF, could Calibre add page breaks (markup) to where it was in the PDF?

rogerinnyc
02-27-2011, 05:20 PM
I hope this is not too dumb a question: If I import an Amazon-purchased book into Calibre (without DRM), and then move it to my Kindle 3 from Calibre, will the Calibre-generated page numbers overwrite the Amazon ones? Or, stated differently, how do the two systems work together, if at all?

user_none
02-27-2011, 05:39 PM
I hope this is not too dumb a question

It's not, It's actually a very good question.

If I import an Amazon-purchased book into Calibre (without DRM), and then move it to my Kindle 3 from Calibre, will the Calibre-generated page numbers overwrite the Amazon ones? Or, stated differently, how do the two systems work together, if at all?

The only way you will have Amazon page numbers is if you download the book to your Kindle using 3G or Wifi. Or if you manually copy the book plus the APNX file to your Kindle. The page numbers are in the APNX file.

If you have a book on your Kindle that has page numbers (APNX file) and you use Send to Device for that same book in calibre the APNX file will be replaced with calibre's.

Calibre itself does not store APNX files with the book. So any files within calibre you put on the Kindle using Send to Device will never have the Amazon page numbers. I don't foresee a conflict because a user sending a book to their Kindle that is already on their Kindle is slim (especially if it's a purchased DRM protected book that cannot be converted).

rogerinnyc
02-27-2011, 06:23 PM
Thanks for the quick reply. That helps a lot. I now see that books downloaded directly to my Kindle from Amazon have a separate APNX file; but if they're downloaded directly to my computer (or Kindle for PC) they don't. Similarly, a book transferred by Calibre's "Send to Device" ends up with an APNX file on my Kindle, but if I use Windows Explorer, I can just copy the .mobi file from My Calibre Library to my Kindle's Documents folder and, presumably, match up the name with the Amazon APNX file. I'm going to have to experiment a bit!

tamahome
03-17-2011, 11:13 PM
Is there a way to add page numbers to the ipad kindle app? :)

I bought Haldeman's Old Twentieth, which has page numbers.

I tried to make an apnx file with the windows app on page 2, and drag it over with the same basename, but nothing changed. There's some kind of mbp file there where you drag the mobi file over.

wallcraft
03-18-2011, 12:03 AM
Is there a way to add page numbers to the ipad kindle app? :)

I bought Haldeman's Old Twentieth, which has page numbers.

I tried to make an apnx file with the windows app on page 2, and drag it over with the same basename, but nothing changed. There's some kind of mbp file there where you drag the mobi file over. I don't have an iPad, but Amazon's app page says: New Features on the Kindle for iPad App

* Real page numbers for thousands of books in the Kindle Store, with more coming soon. Now you can make proper citations in the classroom or follow along with people reading print books in a book club.
* Home screen now shows your progress through books in list view.
* Look up words on Google and Wikipedia without leaving the app.
* Instant word lookup on included dictionary with 250,000 entries and definitions. So, if you have the latest version of the app, it should show page numbers for Old Twentieth. Perhaps you need to sync, or re-download the ebook?

Kindle for PC now has page numbers, and it has an .apnx file for each ebook with page numbers - stored in the same place as the .azw and .mbp files (just like on a Kindle 3). So I think the iPad must use .apnx files too.

tamahome
03-18-2011, 09:55 AM
I'm saying the kindle book I bought show's page numbers fine, but when I try to make my own .mobi file from a free epub file, and try to make an apnx file from the windows app, it doesn't work. How do you convert to azw?

user_none
03-18-2011, 11:06 AM
How do you convert to azw?

For all intens and purposes, MOBI and AZW are the same thing.

tamahome
03-18-2011, 12:37 PM
Can you generate working apnx files for the Kindle pc application?

DMSmillie
03-18-2011, 01:36 PM
Have you made sure you've downloaded the most recent version of the Kindle for iPad application, tamahome? I don't know for certain if the iPad app shows page numbers (though they do show with the latest version of the PC app), but I do know that page numbers won't work on older versions of the app that came out before Amazon introduced the page number feature on the Kindle itself.

tamahome
03-18-2011, 01:45 PM
Yes, I have the latest version of ipad kindle. I'm saying that kindle ebooks I buy show the page numbers just fine. It's just that when I convert a book with Calibre, I'm trying to get page numbers to show up.

DMSmillie
03-18-2011, 02:20 PM
Sorry - I just realised I misunderstood part of what you said in your original post, and asked a mildly silly question as a result. Apologies (cos I know how grrrrr! it is when it seems that people simply haven't bothered to read what one wrote! :o )

DoctorOhh
03-18-2011, 10:57 PM
I'm saying the kindle book I bought show's page numbers fine, but when I try to make my own .mobi file from a free epub file, and try to make an apnx file from the windows app, it doesn't work. How do you convert to azw?

It looks to me as if the Kindle page number generation is built into the Kindle's device interface plugin. Which may mean a simple conversion to mobi or azw won't do the trick.

tamahome
03-18-2011, 11:07 PM
Sorry - I just realised I misunderstood part of what you said in your original post, and asked a mildly silly question as a result. Apologies (cos I know how grrrrr! it is when it seems that people simply haven't bothered to read what one wrote! :o )

No problem. My original post was a little terse.

user_none
03-18-2011, 11:13 PM
... when I try to make my own .mobi file from a free epub file, and try to make an apnx file from the windows app, it doesn't work.

The page numbers are provided by the APNX file. If it is named the same as the MOBI file then there is something wrong with the APNX file.

It looks to me as if the Kindle page number generation is built into the Kindle's device interface plugin. Which may mean a simple conversion to mobi or azw won't do the trick.

Currently the APNX is only generated by calibre when sending a supported format (MOBI, AZW, PRC with BOOKMOBI internal type) to the Kindle using "Send to Device." This is when it happens but the calibre.devices.kindle.apnx.APNXBuilder class could be used outside of the device interface to generate an APNX. A GUI plulgin for instance could be written which calls APNXBuilder.write_apnx and creates an APNX for a specified MOBI file.

Due to the overwhelming popularity of people wanting to have and use APNX files with the Kindle PC and iPad apps I plan on creating a GUI plugin to do this very thing tomorrow. Also, I'm tired of people asking about it and how to do it.

tamahome
03-19-2011, 01:22 AM
Score!

user_none
03-19-2011, 12:11 PM
GUI Plugin for generating APNX files can be found here (http://www.mobileread.com/forums/showthread.php?p=1452519).

Zeebra
03-25-2011, 09:49 AM
Due to the overwhelming popularity of people wanting to have and use APNX files with the Kindle PC and iPad apps I plan on creating a GUI plugin to do this very thing tomorrow. Also, I'm tired of people asking about it and how to do it.

I'd like the record to show I was the first person to continue to bother you regarding adding this functionality. :D Thank you so much!

user_none
03-25-2011, 08:03 PM
I'd like the record to show I was the first person to continue to bother you regarding adding this functionality. :D Thank you so much!

I would advise you read this (http://john.nachtimwald.com/2011/03/21/apnx-file-issues-and-kindle-apps/) regarding issues around the APNX files in the Kindle apps.

Zeebra
03-29-2011, 01:51 PM
I would advise you read this (http://john.nachtimwald.com/2011/03/21/apnx-file-issues-and-kindle-apps/) regarding issues around the APNX files in the Kindle apps.

Strange, is that an issue only with their desktop Kindle app? I've generated APNX files for books and moved them onto my Kindle 3 and the page numbers work without any issue.

user_none
03-29-2011, 02:03 PM
Strange, is that an issue only with their desktop Kindle app? I've generated APNX files for books and moved them onto my Kindle 3 and the page numbers work without any issue.

It's only an issue with Kindle4PC, Kindle for Mac and possibly the Kindle for iPad apps. The generated APNX files work fine in th Kindle 3 device.

DaleDe
03-31-2011, 04:57 PM
This may be old news but I just found out that the 1.2 release of KindleGen can generate page numbers from an NCX file. See NCX in the wiki for details on the syntax. They can also get them from the ADE extension for page-map. So there is a way to generate the exact numbers if you wish.

Dale

user_none
03-31-2011, 05:15 PM
So there is a way to generate the exact numbers if you wish.
Dale

The APNX format can generate exact page nunbers too. The issue with the APNX, which will apply to NCX as well, is where do you get the mapping information that says chapter x starts on page y?

There is no publically avaliable information that maps places in an ebook to a page in a print edition. The only sources right now are purchased books. If you buy the book with this info there is no need to generate an APNX (or NCX) yourself to approximate.

DaleDe
03-31-2011, 06:01 PM
The APNX format can generate exact page nunbers too. The issue with the APNX, which will apply to NCX as well, is where do you get the mapping information that says chapter x starts on page y?

There is no publically avaliable information that maps places in an ebook to a page in a print edition. The only sources right now are purchased books. If you buy the book with this info there is no need to generate an APNX (or NCX) yourself to approximate.

Well, if you wrote the book you would have a copy, or perhaps getting one from a library or mapping from a PDF. I do agree that it is not an easy task unless the source program containing your book source can do it for you. I suspect this will happen soon now that it is defined. Since the ADE method does not create a legal ePUB file and the NCX method does I would hope Adobe will see the light and switch.

Dale

otichy
04-06-2011, 05:40 PM
The APNX format can generate exact page nunbers too. The issue with the APNX, which will apply to NCX as well, is where do you get the mapping information that says chapter x starts on page y?

There is no publically avaliable information that maps places in an ebook to a page in a print edition. The only sources right now are purchased books. If you buy the book with this info there is no need to generate an APNX (or NCX) yourself to approximate.

If there is a PDF version of the book in the calibre library, it might be possible to get the page mapping from there. And it would be really cool feature, by the way, especially for people reading scientific stuff that mostly comes in PDFs now and that has to be citable.

cybmole
04-08-2011, 09:00 AM
i "bought" a free Kindle book from Amazon today & had it delivered to my KIndle for PC app. I see that it came with an apnx file.
I see also there's no obvious way to add a .apnx file to calibre database.

So what is the current thinking & the longer term plan here, if any. - to ignore those files & have calibre generate its own equivalents or to come up with a way of importing tehm alongside of the azw book ?

also, I have the calibre plug in that brings in the Kindle book & strips its DRM in the process - do I have to worry about DRM in the associated apnx ?

user_none
04-08-2011, 09:28 AM
So what is the current thinking & the longer term plan here

They are treated just like any auxiliary file. Ignored. There are no plans to support files other than ebooks within calibre.

also, I have the calibre plug in that brings in the Kindle book & strips its DRM in the process - do I have to worry about DRM in the associated apnx ?

No. The APNX files do not support / require / deal with DRM in any way. The APNX is based on file offsets in the uncompressed HTML contained within the MOBI file. So as long as you don't modify the HTML content the APNX will be correct for the file with or without DRM.

cybmole
04-08-2011, 09:46 AM
They are treated just like any auxiliary file. Ignored. There are no plans to support files other than ebooks within calibre.

.

I could argue that they contain data which is "part" of the ebook, so should they not just be imported & passively stored.

otherwise calibre no longer holds a backup of "all" my kindle content ?

user_none
04-08-2011, 09:52 AM
I could argue that they contain data which is "part" of the ebook, so should they not just be imported & passively stored.

Not going to happen anytime soon.

otherwise calibre no longer holds a backup of "all" my kindle content ?

Backing up all Kindle or all ebook reader content for that matter isn't and never has been a feature or priority. Some device interfaces support a few device specific features but storing those files with the ebook as part of your library is not supported.

Daermond
05-27-2011, 06:53 AM
Hi.

My question is for user_none.
I love your APNX gen plugin for calibre.
I have an idea that I think not a difficult to implement, but useful.

My request is for the accurate page number generation. How here (http://www.mobileread.com/forums/showpost.php?p=1391679&postcount=38) and in the source code also, you mention that the accurate page number generation based on that a book has 70 characters and 32 lines per page. My question is that it is possible that there could be an option to change these variables by users needs. So it would be nice to have an option at the plugins customization for a Custom accurate page number generation option where I can set the number of lines and the number of characters per page.
I think it will be useful. So everyone could fine tune the page number parameter by his/her needs.
I have a kindle with custom font (Liberation Sans) with second size font and with small line spacing. With these layout configuration I could count the lines per page and an average characters per line, and based on these custom data I could set the APNX generations parameter. I could get a closer Kindle page numbering result, so I would get a closer result how page turns left from a chapter and approximately how much kindle page the book has.
I know that it will not gives a precise result but it would be fare more closer to the real kindle pages by my settings. May a few pages difference per 100 pages.
And these settings could be useful for paper book conversation of course if the lines and character numbers are known.

If it is possible please implement it in the future version.
Thanks,
Daermond.

user_none
05-30-2011, 12:28 PM
@Daermond, having page numbers gives two things. A way to keep your place that makes more sense than location 828002 and to give a comparison between books. Having user configurable page sizes would remove the second advantage of having page numbers. I personally don't see user configurable amounts necessary and I don't have plans to add it. If someone else wants to they can.

I would rather spend my time making the more accurate parser even more accurate than making it configurable.

Daermond
05-31-2011, 01:46 PM
Yes you have right what gives page numbering. What I want with the configurable lines and characters per page is that for my custom Kindle settings I could compare books, how much "Kindle Pages" it has and a better way instead of locations, where I'm in the book and how much turns are left from a chapter.
That is ok that you don't feel these optin neccessary or that these option is not good.
By the way I'm happy that the parser will be more accurate in the future.

For my needs I have made some changes in your APNX Generator GUI plugin if you don't mind.
I have added the apnx.py from Calibre source with my custom settings into your plugin and modified to call the APNXBuilder routine from the apnx.py in the plugin rather than from Calibre built in kindle interface plugin.
The result was what I expected! :)
With my custom settings I could create an apnx file where was just a few pages differece per 100 kindle page turns.
Now I can see that how long (how much kindle page turns) is a book and how much turns left from a chapter to finish the reading and go to sleep. :)
So I made it.
Thanks for the plugins! And I wait to a more accurate parser.

philmate
09-04-2011, 05:11 PM
There is no publically avaliable information that maps places in an ebook to a page in a print edition. The only sources right now are purchased books. If you buy the book with this info there is no need to generate an APNX (or NCX) yourself to approximate.

Hi. I'm new here and a newbie when it comes to formatting ebooks. Sorry for resurrecting an old thread, but I have a particular interest in it.

There are cases where there is a need to generate references to page numbers in a print edition, and I am working on such a case now, for Kindle Direct Publishing. The book concerned is non-fiction -- hence the desirability of being able to cite it with page references. It is out of print, but there is likely to be a renewed interest in it when a new book that is now in preparation is published (in print and ebook form).

I can live without a publicly available map of pagination information. I am prepared to manually identify page starts in the text by comparing with the out-of-print paper version. Time-consuming maybe, but it would be worth it to me. Is there any way of inserting that information into an APNX file? Of course, if Amazon would tell us how to do it, that would be preferable, but they haven't seen fit to ...

Any help greatly appreciated.

DaleDe
09-04-2011, 05:17 PM
Hi. I'm new here and a newbie when it comes to formatting ebooks. Sorry for resurrecting an old thread, but I have a particular interest in it.

There are cases where there is a need to generate references to page numbers in a print edition, and I am working on such a case now, for Kindle Direct Publishing. The book concerned is non-fiction -- hence the desirability of being able to cite it with page references. It is out of print, but there is likely to be a renewed interest in it when a new book that is now in preparation is published (in print and ebook form).

I can live without a publicly available map of pagination information. I am prepared to manually identify page starts in the text by comparing with the out-of-print paper version. Time-consuming maybe, but it would be worth it to me. Is there any way of inserting that information into an APNX file? Of course, if Amazon would tell us how to do it, that would be preferable, but they haven't seen fit to ...

Any help greatly appreciated.

The data can be placed in the toc.ncx file. See the wiki for details on apnx and ncx.

Dale

philmate
09-04-2011, 06:22 PM
The data can be placed in the toc.ncx file. See the wiki for details on apnx and ncx.

Dale

Wow -- a reply in 6 minutes! Thank you so much, Dale. :hatsoff:

I located references in the wiki to what KindleGen needs to generate an APNX file at http://wiki.mobileread.com/wiki/APNX. It will take me more than 6 minutes to get my head around the toc.ncx pageList feature (see http://wiki.mobileread.com/wiki/NCX) or alternatively the separate page-map.xml file (see http://wiki.mobileread.com/wiki/Adobe_Digital_Editions#Page-map), but I will persevere.

Reading that stuff made me realize that it might be necessary to test what I do by getting the files onto my device rather than just using Kindle Previewer.

Thanks once again, Phil

philmate
09-05-2011, 02:02 PM
The data can be placed in the toc.ncx file. See the wiki for details on apnx and ncx.

Dale

@Dale:

Sorry to be a pain, but I now have a further question that I haven't been able to find an answer to on the forum or the wiki (or anywhere else, for that matter).

I understand that the NCX file needs to include a pageList section, an example of which is set out in the wiki entry on NCX. However, I presume that the appropriate tags or anchors also need to be included in the HTML text of the book itself at the beginning of each "page". Can you possibly explain the syntax that those tags or anchors need to comply with, or refer me to somewhere that will explain?

Thanks tons.

wallcraft
09-06-2011, 09:01 PM
I understand that the NCX file needs to include a pageList section, an example of which is set out in the wiki entry on NCX. However, I presume that the appropriate tags or anchors also need to be included in the HTML text of the book itself at the beginning of each "page". Can you possibly explain the syntax that those tags or anchors need to comply with, or refer me to somewhere that will explain? The format in the NCX file is, for example: <pageTarget type="normal" id="pagetarget000007" value="7" playOrder="7">
<navLabel>
<text>7</text>
</navLabel>
<content src="part0000.html#page-7"/>
</pageTarget> So you would include an anchor in part0000.html indicating where page 7 starts as follows:<a name="page-7"></a>

philmate
09-08-2011, 12:11 PM
Thanks tons, Wallcraft. I'll give it a try. Phil

philmate
09-08-2011, 08:09 PM
@wallcroft:

I tried it and couldn't get the result. But I think I'm making a mistake in the next step. Could you possibly explain to me how to render the (various) file(s), and how to test them? Can I send the file(s) to my kindle email? Which files? Zipped? Or should upload the file(s) to KDP? I'm sorry to be a nuisance asking dumb questions, but I can't seem to find the answers by looking at either the Amazon site or the forums.

philmate
09-21-2011, 02:19 PM
The real page number navigation feature is still eluding me. There IS a need for it, I think, for being able to cite passages from academic books that have previously been published on print.

Kindle Direct Publishing will add real page numbers after uploading onto KDP, but only in defined circumstances, which do not appear to include books that have already gone out of print. That's a pity, because one might expect that to be a common reason for wanting to publish an ebook version.

I have added a pageList section to the NCX file and anchors in the source file, but no luck so far. The NCX and APNX entries in the Wiki give a helpul lead, but they don't explain how to get to the end result in a practical way.

If anyone has any practical success in getting that to work, it would be great to hear about it here.

Phil

kundor
10-02-2011, 10:38 AM
Philmate,
I really don't know anything about it, so sorry if you're way past this. But I think you have to include the ncx file in the ePub file (add it to the zip archive), include it in the manifest, "reference it in the spine toc attribute", and replace the content pages with your modified ones with anchors. Then you feed the modified ePub file to the command-line kindlegen program.

Note that the wiki (http://wiki.mobileread.com/wiki/APNX) says "KindleGen version 1.2 does not generate an APNX file directly; it creates a PAGE section in the MobiPocket file which is then stripped and converted to an APNX file by Amazon's publishing service. The KindleGen input can use either a NCX pageList or page-map xml.

Kindle Previewer, as of version 1.5, does not display page numbers. In addition, Kindle for PC and Kindle for Mac, while they do display page numbers using .apnx files, are unable to read them from a MobiPocket file generated by KindleGen. This makes testing the page number feature somewhat problematic for publishers."

Rory OConor
10-26-2011, 03:33 PM
Glad you seem to be sorting out Kindle Page numbers.
I use Calibre to convert Project Gutenberg HTML files into MOBI for my Kindle, as Calibre provides much more of the formatting than the PG MOBI files.

I have now become a Post-Processor on the Distributed Proofreeding site, who provide HTML files to PG.

the standard DP pagenumbers are formatted as follows:

In the header, the class

.pagenum { /* uncomment the next line for invisible page numbers */
/* visibility: hidden; */
position: absolute;
left: 92%;
font-size: smaller;
text-align: right;
} /* page numbers */

And then embedded within the body text:

<span class="pagenum"><a name="Page_xx" id="Page_xx">[xx]</a></span>
or
<span class="pagenum"><a name="Page_xxx" id="Page_xxx">[Pg xxx]</a></span>

Would it be possible using the above information for Calibre to produce Kindle files with page numbers from Project Gutenberg HTML files?

ps: Calibre only seems to produce .mobi and .opf files (who knows) when I use it. No .apnx file.

regards

Rory