When exporting to PDF I am trying to number my exported pages as headings in a manner which will match a ToC. I have added the following CSS to the Global PDF StyleSheet:
body
{ counter-reset: h2counter; }
h1
{ counter-reset: h2counter; }
h2:before
{ content: counter(h2counter) ".\0000a0\0000a0"; counter-increment: h2counter; counter-reset: h3counter; }
h3:before
{ content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; counter-increment: h3counter; }
This is not functioning correctly on anything other than H2 titles (H1 are excluded to prevent the master page being numbered). Currently I receive export similar to the below:
Confluence Space-
Master page
Page 1
Nested page second level 1
Nested page second level 2
Nested page third level
Nested page fourth level
Page 2
PDF Export-
{ToC}
Master page title
1. First level heading one
1.1 Second level heading one
1.1 Second level heading two
Third level heading one
Fourth level heading one
2. First level heading two
I understand I have only implemented CSS for numbering of effectively 2 tiers of headings at this stage, I wanted to confirm functionality and it failed. The main issue is the lack of incremental numbering on the second level headings, if I can resolve this I can work on implementing the same fix for third tier onwards, any suggestions would be greatly appreciated.
@Jim:
I now fully understand your question, I can totally reproduce it and I get exactly the same result ;-(
In other words: It can't get that second level to increment either.
The code I posted before is the code used in the confluencedefaultpdf.css, is the basis for the default toc of a space export and seems to work everywhere except for what you want.
No idea, if I overlooked something real simple but I am at my wits end.
Thanks for all your help Steffen. It boggles my mind a little that the ToC is able to successfully generate it's numbering based on the provided CSS but the numbering will not directly apply to the headings themselves. Presumably there is a difference in the way the CSS is handled within the body of the export, but I can't for the life of me tell what it is.
I have a support request lodged with Atlassian, part of their suggestion for resolution was to post a question here; hopefully someone happens upon it who has an idea why the two areas behave differently with the same code. Otherwise, if support get back to me with a resolution I will post the result here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just a quick update - I'm still in discussion with Atlassian support who have been unable to provide me we a resolution thus far. They have acknowledged that there is an issue with the CSS/CSS handling, however provided answers to a non-issue; I am waiting on further comment or a resolution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As suspected, this is a fault with Confluence. If you are interested in seeing this corercted, please vote on the issue here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I said your question is quite complicated but
I tried both before I answered.
But there is quite a lot of points where things can go wrong. For example I haven't fully understood
In short, I think it will work but it is complicated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just recognized you are using OnDemand. Not sure if it is the same there or not...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your effort thus far Steffen, I'm unsure myself if the export to PDF operates in the same manner for the different instance types.
1. This is for a space export, none of the pages include headings, I am reliant on the page titles to generate headings in the document and have segmented my document into pages for this purpose.
2. I am referring to the space export ToC.
3. I am referring to the page used as a container for my 'document', ie the highest level page that all others sit under as sub pages.
4. The ToC numbers automatically, I am attempting to have the numbering added to the headings that generate from the page titles, based on their level in the space structure.
5. I was not aware that headings increment on export... Seemingly this isn't the case though as my exclusion of h1 results in the 'master' page not being numbered (unless it is incremented from 'title' to h1).
You're not wrong when you say this is complicated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't fully understand your question but, as regards, the lack of incremental numbering try the following.
body { counter-reset: h2counter; } h2:before { content: counter(h2counter) ".\0000a0\0000a0"; counter-increment: h2counter; } h2 { counter-reset: h3counter; } h3:before { content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0"; counter-increment: h3counter; } h3 { counter-reset: h4counter; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steffen,
The output remains the same; no numbering past x.1 and no counter incremement on the second numbering tier.
Thanks,
Jim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.