View Full Version : Page Mapping Using toc.ncx


lorddon
07-09-2010, 06:38 PM
In my brief research I've found that adobe's method of page mapping is non standard and frowned upon by epub checkers. I discovered the preferred method is to use <pageList> under <navMap> in the toc.ncx, as described here (http://www.epubbooks.com/blog/20081209/marking-up-page-numbers-in-the-epub-ncx/).

<pageList id="page-mapping">

<navLabel><text>Paper Edition Page Mapping</text></navLabel>

<pageTarget id="page-iii" value="3" type="front" playOrder="82">
<navLabel><text>Page iii</text></navLabel>
<content src="frontmatter.html#pageiii"/>
</pageTarget>

<!-- ... -->

<pageTarget id="page-105" value="105" type="normal" playOrder="192">
<navLabel><text>Page 105</text></navLabel>
<content src="chap5.html#page105"/>
</pageTarget>

</pageList>

My difficulty now is I don't understand how or where you add the anchors to mark where the pages begin in the xhtml files themselves.

frabjous
07-09-2010, 06:44 PM
I wouln't bother. Unless someone knows something I don't, or something has changed recently, I'm pretty sure the "preferred" method is not supported by any ePub software.

We've discussed this before. (http://www.mobileread.com/forums/showthread.php?t=53195)

I imagine however, that you're just supposed to use anchor tags. E.g. <a id="page105">first-word-of-page</a> inside chap5.html.

charleski
07-09-2010, 07:35 PM
It would be interesting to know if iBooks supports pageList.

st_albert
07-09-2010, 10:35 PM
It would be interesting to know if iBooks supports pageList.

Apparently they do. This is from page 13 of the iTunesConnect_PublisherUserGuide.pdf :

Page Mapping
To provide a reading experience similar to printed books, the person reading a book on the iPad should be able to refer to and navigate to a particular page. This is especially useful in a classroom setting when the teacher instructs the students to go to a particular page in a textbook. An NCX (Naviagtion Control file for XML) file lets the reader jump directly to any of the major structural elements of the document (for example, chapter or section) or to a particular page. To provide navigation to a particular page, use the NCX defined pageList. Below is an example:

<pageList>
<pageTarget id=”p1” type=”normal” value=”1”>
<navLabel><text>1</text></navLabel>
<content src=”content.html#p1”/>
</pageTarget>
<pageTarget id=”p2” type=”normal” value=”2”>
<navLabel><text>2</text></navLabel>
<content src=”content.html#p2”/>
</pageTarget>
</pageList>


Further documentation on the pageList can be found here:
http://www.daisy.org/epub/issues/clarify-ncx-reading-system-requirements

CrystalEYE
07-20-2010, 09:12 AM
As far as I understand, you don`t have to use anchors, but simply ids.
e.g. <p id="page105">First paragraph on page 105 in the printed version</p>

soup
07-20-2010, 01:49 PM
I think I found the answer to this the other day, I copy and pasted a line of code I thought would work and it did.

I don't have the code on me right now, but if you find an ePub with a working table of contents, maybe what I can remember off hand might be enough, however I'll post what I use up when I get the chance, I found it works remarkably well.

in the book I had with the line of code that worked, the code was around the chapter title, it read something like:

"calibre5_calibre3_toc_id1<title_chapter 1>"

now I KNOW that isn't the exact code, but it should help you find the right code if you have a book that has a working table of contents, also this was an ePub converted from a PDF using calibre.

if you do find the line, the '1' in "toc_id1" can be any number, and only have to be in chronological order, 1, 100, 1000, 10000 will wok just as well as 1, 2, 3, 4 etc.

the "chapter 1" part can read as anything you like, it will read on the TOC the same as that line of the page, but the font will be different.

you can place them anywhere in the page, it doesn't have to be at the beginning.

this worked on my kobo, I don't know what your reader is or if this will work on it, I'm new to this.

hope this helps. I should be able to give the exact code in about 10 hours time after this post.

soup
07-22-2010, 09:59 AM
it took me a little longer to get my hands on it for you, but fially, it's here.

<h1 class="calibre7 calibre3 sgc-1 sgc-8" id="calibre_toc_3">Chapter 1</h1>

I just paste that code into any line I want to reference in my table of contents, and it comes up.

someone who knows more than me would probably be able to clean in it up for you, and give you a shorter line of code, but it does the job.

as I said before, the "3" in " id="calibre_toc_3" " is changable, and provided that the numbers are increasing order, they don't have to be in next number order.

the "Chapter 1" can be anything you like, but it will come up on both the line of the page you're referencing aswell as the table of contents, the font will be different on the table of contents.

as I said, this is from an epub that was converted from a PDF with calibre, edited with sigil, and worked correctly on the kobo; just a few points of reference for you.