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

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

98 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you