Forum How do I...?

Having trouble resetting page numbers

quiredan
I'm having issues getting the page numbering correct in my PDFs.

Here's what I'm trying to do:

Cover Letter (no page number)
Title Page (no page number)
Executive Summary - start with page "i"
Table of Contents - continue roman numerals
Table of Appendices - continue roman numbers
Document Body - reset to page "1"
Appendices - (no page numbers)

I have the roman numerals displaying but they seem to be resetting for each section. So I end up with

Executive Summary - i
Table of Contents - i and ii
Table of Appendices - i

After that the regular numbers on the Body reset to 1 and display as expected for that whole section.

The basic structure of the html looks like this:

<div class="cover-letter"></div>
<div class="title-page"></div>
<div class="report-summary"></div>
<div class="toc"></div>
<div class="toa"></div>
<div class="report-body"></div>
<div class="appendix"></div>
<div class="appendix"></div>
<div class="appendix"></div>


And then styles that look something like this:

@page intro-content {
    margin: 1in;
    @bottom-right {
        content: counter(page, lower-roman);
    }
}

@page body-content {
    margin: 1in 0.35in;
    @bottom-right {
        content: counter(page);
    }
}

.report-summary {
  counter-reset: page 1 pages 1;
}

.toc,
.toa,
.report-summary {
  page: intro-content;
}

.report-body { 
	page: body-content;
	counter-reset: page 1 pages 1;
}




Does it have something to do with using a single named page across multiple html containers?
howcome
I can't replicate the behavior you describe. In this document, the counter reset as it seems you prefer.

http://www.princexml.com/howcome/2013/test/counter-reset.html
http://www.princexml.com/howcome/2013/test/counter-reset.pdf

Another example is here:

http://www.princexml.com/samples/#book

-h&kon
quiredan
I think it may have something to do with CSS rules being overridden. What I posted here was a simplified example of what I'm experiencing. I assumed it was behaving the same way but obviosuly it's not.

I'm trying to figure out the best way to describe the situation but in the meantime:

If I set the "page" property of these elements in separate stylesheets, should they follow the same inheritance rules as any other CSS properties? Can I use the !important flag on the prince-specific properties like 'page' and force them to override any other styles that might be applied? (Aside from other !important styles obviously).


quiredan
In other words, if one stylesheet has:

.toa,
.toc {
   page: body-content;
}


And then another one has:

.toc,
.toa {
   page: intro-content;
}


Would the second stylesheet override the first? And are there any implications when counter resets are also being applied?

Sorry if this is confusing. I may have to send you a better example so you can see all the files that are involved.
howcome
Yes, the second rule overrides the first. Counter properties adhere to the same rules: the last rule wins (assuming the same specificity).

Perhaps you could start from the simple example that works and add bits until it breaks?

-h&kon