I am combining several small XHTML documents into a single PDF with the first one being a "front matter" document, which contains a cover page and a table of contents. All the documents share a templated structure with header, footer and content sections. The same CSS is also used in each document, with an additional stylesheet for the front matter.
What I want to do is have the page numbering in the front matter in roman numerals, starting from the page following the cover page, and being reset to numbers starting from 1 on the first page of the document following the front matter (the first "real" content).
The problem is that a page counter reset only seems to work when triggered by encountering a source element with the reset rule applied, and causes that element to appear on a new page.
In my case, I want to reset the page numbering for the content following the front matter. But the content is made up of multiple documents all with the same basic structure and which may appear in any order, so any counter-reset rule applied to a content page element will affect all source documents and reset the page numbering for each document. So the obvious solution is to reset the page numbering through a rule applied to the front matter, which does have unique elements.
Ideally I should be able to use a rule like:
but unfortunately the counter-reset doesn't seem to work when applied to pseudo elements. The only other option I could think of was to create a new div element to the end of the front matter source purely to trigger the counter-reset. This does work, but it causes a blank page to be inserted between the front matter and the first page of content.
Being able to trigger counter rules with pseudo elements would be the best solution, but using "brute force" elements would be an acceptable (if inelegant) solution - provided the forced page break can be suppressed.
Are there any other options I might have overlooked?
What I want to do is have the page numbering in the front matter in roman numerals, starting from the page following the cover page, and being reset to numbers starting from 1 on the first page of the document following the front matter (the first "real" content).
The problem is that a page counter reset only seems to work when triggered by encountering a source element with the reset rule applied, and causes that element to appear on a new page.
In my case, I want to reset the page numbering for the content following the front matter. But the content is made up of multiple documents all with the same basic structure and which may appear in any order, so any counter-reset rule applied to a content page element will affect all source documents and reset the page numbering for each document. So the obvious solution is to reset the page numbering through a rule applied to the front matter, which does have unique elements.
Ideally I should be able to use a rule like:
#frontMatter:after { counter-reset: page 1; }
but unfortunately the counter-reset doesn't seem to work when applied to pseudo elements. The only other option I could think of was to create a new div element to the end of the front matter source purely to trigger the counter-reset. This does work, but it causes a blank page to be inserted between the front matter and the first page of content.
Being able to trigger counter rules with pseudo elements would be the best solution, but using "brute force" elements would be an acceptable (if inelegant) solution - provided the forced page break can be suppressed.
Are there any other options I might have overlooked?