Forum How do I...?

Total page number offset

caudingo
Is there a way to offset the result of
counter(pages)


I need to insert 4 decorative pages at the beginning of a report (before the table of contents) and would like to exclude those from the "page X of Y" count.

I tried
content: calc(counter(pages)-4)
without success.
mikeday
calc() isn't supported yet, but you can do with JavaScript functions, like this:
<style>
@page {
    @bottom { content: prince-script(minusFour, counter(pages)) }
}
</style>
<script>
Prince.addScriptFunc(minusFour, function(x) { return Number(x) - 4; });
</script>
caudingo
Great! And how about suppressing the counter on the first 4 pages?
@page:nth-child(3) {
    @bottom-right {
        content: "";
    }
}
doesn't seem to be working.
mikeday
You can use @page:nth(3), or make them a named page group.
caudingo
Thanks, perfect.