You have full control over the creation of TOCs using XSL style sheets to generate them. You can get the default stylesheet using the argument --dump-default-toc-xsl
for wkhtmltopdf.
When you study it, you are particularly interested in the <body><h1>...</h1>
H1 element and the xsl:if test="(@title!='')"
test xsl:if test="(@title!='')"
For example, when I want to remove TOC self-promotion from myself, this is an important part of my stylesheet:
stuff above <h1>My little TOC</h1> <ul><xsl:apply-templates select="outline:item/outline:item"/></ul> </body> </html> </xsl:template> <xsl:template match="outline:item"> <li> <xsl:if test="(@title!='') and (@title!='My little TOC')"> stuff below
When you save the new TOC XSL, you need to reference it in your wkhtmltopdf arguments using something like --page-size A4 toc --xsl-style-sheet test.xsl TempFile.html TempFile.pdf
.
source share