Search code examples
drupal-8wkhtmltopdf

How to style table of content with wkhtmltopdf?


I generate a pdf file from HTML, with the help of Entity Print module and wkhtmltopdf engine. I have an issue that I can not theme the table of content. By the similar issue here I guess that I need to do it through custom xsl sheet, but I don't know how can I set it.

I have tried in PhpWkhtmlToPdf.php under /* TOC handling */

$this->getPrintObject()->setOptions(['xsl-style-sheet' => 'link to xsl sheet']);

$options[] = ['xsl-style-sheet' => 'link to xsl sheet']; 

But it did not work.

All formatting which I have in entity-print.css affect the whole generated docs, but not the table of contens. Please, help.


Solution

  • $this->getPrintObject()->addToc(array('xsl-style-sheet' => '../entity_print/files/custom-toc.xsl'));