Forum How do I...?

toc with page numbers (multiple files)

Babelfish
I put several html files into a pdf and have no idea how to create a toc with page numbers.

All file names are in a content.txt file:

  • cover.html
  • toc.html
  • chapter1.html

The toc.html contains a unordered list with page links:

<ul>
  <li><a href="chapter1.html">Chapter 1 – Title</a>
    <ul>
      <li><a href="chapter1_1.html">Headline 1</a></li>
    </ul>
  </li>
  …


If I create the pdf, it works and I have a interactive toc with jumpable links:

  • Chapter 1 – Title
    • Headline 1

But I need also the page numbers for the chapters and sections:

  • Chapter 1 – Title .............................. 5
    • Headline 1 .............................. 6

Is there a way to realize that?
mikeday
Sure, how about something like this:
.toc a[href]::after {
    content: leader(".") target-counter(attr(href), page)
}

It's described under documentation for cross-references.
Babelfish
Works great. Thanks!