It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Confluence

Introducing Confluence Cloud and Jira Software Cloud Premium

Wherever you are in your team’s journey , our goal is to support your big ambitions. We’re a cloud-first company with the mission of unleashing the potential of every team, and to address the range ...

694 views 5 18
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you