Forum How do I...?

Stop and start page numbering

prince.eggs
The first two and last two pages of a booklet are the cover and do not need page numbers.

One can select the first page with @page:first and the second with @page:nth(2), but I do not know how to select the last two pages. I guessed @page:nth(-2) and @page:nth(-1) but no luck.

I also can't seem to get page numbering to start with the number 1 on page 3. The page counter seems to be a constant. Named pages are of little help, since I don't know what will end up on what page as all the content is being slurped up and I'm trusting prince with all the page breaks.

What am I missing?

Thanks.
mikeday
Currently it is not possible to select last pages. However, you can reset the page counter so that page 1 falls on the third page, like this:
<html>
<head>
<style>
@page {
    @top { content: counter(page) }
}

body { counter-reset: page -1 }

h1 { page-break-before: always }
</style>
</head>
<body>
<h1>First page</h1>
<h1>Second page</h1>
<h1>Third page</h1>
</body>
</html>