View Full Version : page numbers & chapter titles

09-23-2012, 06:58 PM
( Depending on the solution of the problem, the thread might be misplaced, feel free to move :rolleyes: )

I am manually converting a book to an ebook and I have found a problem I couldn't solve by trying and google-ing, so here I am :) ...

The way i'm working it is to firstly translate the book to a html file ( because it is german fraktur, ocr doesn't work sometimes ) and then to convert the html with calibre.

My question is, how can I make the epub show the page numbers and chapter titles on every page, together with some special formatting?
As I said, I googled and found the solution to be to implement a certain form of css in the epub. I looked over the calibre stylesheets ( calibre/resources/templates ) but couldn't find a @page { ... } tag. So I switched to Sigil and found my desired line there, but all editing led to nothing. Now, I would like to know, what error ( if i have made one ) I have made.
The lines:

body {
display: block;
page: main;
counter-reset: page 1
@page main {
@top { content: string(chapter-title) }
@bottom {
content: counter(page)

chapter title { string-set: chapter-title content() }

( sony prs-t1, btw ;) )
Thank you for your help!

09-23-2012, 07:29 PM
Moving to EPUB forum since this is not really a Calibre Conversion issue

09-24-2012, 01:15 AM
Well, one problem is that the @top and @bottom are part of CSS3. In the specificatios for ePUB2 (what the T1 uses) CSS2 is used.
What you want is not possible with ePUB2.

09-24-2012, 04:03 AM
Thank you, so I'll have to think about rooting then ...
and besides, I just applied the css changes to the epub file without moving it to my reader, and it didn't work there ( the calibre epub viewer ) too ...

09-24-2012, 09:55 AM
Rooting won't help you there. There might be an android reader that can read ePUB3, but even then it remains questionable whether it will work.

The Calibre (and Sigil) viewer are actually a web renderer and not an e-book renderer. It should not be used to test if something works. It is better to test in ADE (no ePUB3 though).

09-25-2012, 08:26 AM
There's a related forum post about headers and footers here: (not really a solution, just for more info about this)

09-26-2012, 01:08 PM
just found an interesting blog post about a similar problem with a solution in html ... i should try it, but it looks promising so far ...

if it would work, i could easily define that structure before every chapter and then ... goodbye, css!

09-26-2012, 01:48 PM
There are two more things, you could look into:

1. Add a page-map file ( to control the page number display in ADE and RMSDK based eReaders.

2. Create a fixed layout ( book. I.e. create an .html file for each page. This would allow you to hard-code headers, footers and page numbers, but somehow defeats the purpose of reflowable content.

10-04-2012, 03:42 PM
ADE already displays the page number. So that's a non-issue. As for displaying a header. I am very glad ADE doesn't do that. Just a waste of screen space (IMHO).