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

TOC is not being created when I export a space to PDF, what am I doing wrong?

I've read the information here: https://confluence.atlassian.com/display/AOD/Customising+Exports+to+PDF#CustomisingExportstoPDF-TableofContents

but still do not have a toc in my PDF.

When I read the above link it says that "By default, a table of contents will be generated after the title page, or at the beginning of the PDF document if no title page is defined in the PDF Layout. To see the default CSS rules applied to the table of contents, download the default CSS rules (confluencedefaultpdf.css) and examine the specific rules with toc in their name."

I have a title page but no toc, anybody have any ideas? Do I need to add html based on the css to "PDF Space Export Title Page"?

Here is the code I'm using for my title page in the layout if that helps:

<div class="fsTitlePage">  
   <div style=" text-align:right">  
   <img src="/download/attachments/3309581/ctCRE.png"/>  
</div>  
<div class="fsTitle">Enter Release name</div>  
<div class="fsTitlesub">Release Review</div>  
<div class="fsTitlesubsub">Status: Final <br> Version: 1.0 <br> Date Revised: July 23, 2013 </div>  
</div>

5 answers

1 accepted

0 votes
Answer accepted

I never heard of Space > Space Tools > Content Tools > Export. Is that the OnDemand version?

Anyways, seems like you use that form of export where you can include multiple pages. If you do exactly that (=> select multiple pages) and do not only choose "the one page that I need to export" then you should get a proper toc.

The reason is that this(!) toc is created not from the headings within a single page but from the page titles of the chosen pages. If you choose only one page then there is nothing that a toc could be created from. The toc contains only one entry and this one is presented without page numbers. If you add more pages the toc gets its entries and these are presented with page numbers.

Yes, I'm using On Demand.

And ugh, not the answer I wanted. :)

Thanks for your help.

If you choose "Output Type=list" from the "Edit" menu the {toc} macro should create a toc in the form of a normal list (with <ul> and <li>)

The appearance of that list can be adapted and refined with CSS that you enter at Browse > Space Admin > Look and Feel > PDF Stylesheet > PDF Export Stylesheet

If you want page numbers and a dotted line you can use

a:after {    
content: leader(dotted) target-counter(attr(href), page);   
}

To avoid that all other hyperlinks on your page also get page numbers you better put your toc into another css class. For this you enter some_class_name (choose whatever you like) at "CSS Class Name" from the Edit menu of the {toc} macro and put exactly that some_class_name before the "a:after" so that you get ".some_class_name a:after" (don't forget the dot at the beginning).

Exactly what I was looking for.

Thank you very much :)

How do you export your pages? Do you export with Browse > Advanced > PDF Export and not with Tools > Export to PDF?

I am using the heading styles in Confluence. I can create a table of contents using both of the TOC macros but that doesn't give me a separate page for the TOC when I PDF, just adds it on top of my first page after my Title page.

I'm using the advanced pdf export. Space > Space Tools > Content Tools > Export. I choose Custom Export and select just the one page that I need to export.

0 votes
Deleted user Jul 24, 2013

Forgive me if this is too basic. Have you applied 'heading' styles (h1, h2, h3 etc) to your pages? ... any generated toc looks for heading styles to build from. If you've only formatted headings by applying bold, larger font sizes etc., then the toc generator will have nothing to work with.

@Trina

If you have a single page and you want to create a toc from the headings within this page then you can use the {toc} macro. That(!) toc appears at exactly the place where you put it, both on the confluence page and in the exported PDF.

If it is important to you that this toc appears on a separate page then just put it at the top of your page and include a pagebreak right after it. You can include a pagebreak using the {div} macro and

page-break-after: always;

at the input field "Styles" from the "Edit" menu of the {div} macro (there are numerous other ways to do it).

Thank you Steffen.

But how do I get page numbers in that TOC? Is it possible if I set up my {div} correctly?

Thoughts?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

The New and Improved Confluence Mobile App!

  Hey Community! I’m Stephanie Zhang, a Product Manager along with @Wei on the Confluence mobile app. Our team has been hard at work to deliver helpful enhancements to the Confluen...

234,701 views 4 12
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