Search code examples
c#asp.netasp.net-corewkhtmltopdfnreco

NReco - wkhtmltopdf - Table of content(TOC) is not generating


I am using wkhtmltopdf 0.12.5 with NReco (Asp.net core). I have set TOC to true

HtmlToPdf.GenerateToc = true;
HtmlToPdf.TocHeaderText = "INNEHÅLLSFÖRTECKNING";

I am getting document outline with the proper header text but toc is not generated. Am I missing anything?


Solution

  • This is a known issue in wkhtmltopdf 0.12.5 release: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3989

    It fix that it is enough to upgrade to latest 0.12.6 release (or downgrade to 0.12.4 if this is not possible for some reason).