How do I restart the page numbering after the Table of Contents in the PDF export?

Anna McDonald September 30, 2014

I want the page numbering to begin after the Table of Contents on the PDF export. The Title Page and Table of Contents page(s) should not be counted. For example, I want to export a pair of pages in a small section that total 3 PDF pages. The Title Page and Table of Contents pages add 2 pages, making the PDF itself 5 pages long. The kicker is that the Title Page and Table of Contents pages should not be counted in the page numbering in the footer of the PDF. The layout is as follows:

  • Title Page
  • Table of Contents Page
  • 3 Content Pages

The content pages are where the numbering should begin. I want those pages to begin at page 1 and not page 3. How can I fix this in the stylesheet? I cannot find any answers. I think I should be able to use a counter-reset, but I cannot get it to work. Thoughts?

P.S. It looks like someone asked a little over a year ago and never received an answer: https://answers.atlassian.com/questions/138335

 

1 answer

0 votes
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2014

As already said in the other thread, "counter-reset" seems to be ignored for "counter(page)".

It works for self defined counters, though. For example, if you create your own numbers for headings and want it to start with "42", you can achieve it with this:

body {
counter-reset: myOwnHeader 41;
}
h2:before {
content: counter(myOwnHeader) ". ";
counter-increment: myOwnHeader;
}

You could somewhat recreate that for your case.

1) Add this to your stylesheet:

/* create a counter "myPageNo" and define its initial value 3 */
body {
counter-reset: myPageNo 3;
}
/* create a class "MyPageNoText": set its position and what it will display */
.MyPageNoText { 
position: running(PageNo); 
}
.MyPageNoText:before {
content: "this is page " counter(myPageNo);
counter-increment: myPageNo;
}
/* position the class on the PDF page */
@page {
@bottom-right { 
content: element(PageNo); 
}
}

2) Add an empty "span" or "div" macro to your wiki page and set the "Class" to "MyPageNoText".

This will add a "this is page 4/5/6..." to the bottom of your pages, starting at that point where you include the class (include it on page 3 and the first two pages won't have no page numbers at all).

 

I tested it. It works!
But nobody would really do it like that wink.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events