I'm using wkhtmltopdf to create an user manual from an html source. I already managed to number the pages thanks to this.
Now I wonder if there is any way to auto generate a document index based on the header tags on the html source.
For instance, if I have this:
<h1>Cars</h1> (page 3)
<p>blah blah blah</p>
<h2>Peugeot</h2> (page 3)
<p>blah blah blah</p>
<h2>Renault</h2> (page 4)
<p>blah blah blah</p>
<h1>Supermarkets</h1> (page 5)
<p>blah blah blah</p>
<h2>Walmart</h2> (page 7)
<p>blah blah blah</p>
<h2>Carrefour</h2> (page 11)
<p>blah blah blah</p>
I would like to have an auto-generated document index that looks like this:
User Manual Index
Cars.......................3
Peugeot..................3
Renault..................4
Supermarkets...............5
Walmart..................7
Carrefour................11
Is it possible to achieve it using wkhtmltopdf / JavaScript ? At least could you please advice me where to start?
Thanks in advance.