Open nichbeau opened 5 years ago
In case anyone else ends up here needing a solution to this...
Subclass ObjectSettings
and add a property to set the table of contents flag to true
:
public class TableOfContentsSettings : ObjectSettings
{
[WkHtml("isTableOfContent")]
private bool IsTableOfContents
{
get => true;
}
}
You can then add this object wherever you want the ToC to appear in the pdf. Something similar could probably be done with the Cover object type, but I've not got round to trying that (yet).
@garymcleanhall thanks, It worked but just the first time. I'm using .net core 2.2. After implemented, I call API to generate the PDF file. It works well for the first time and the next time, pdf file shows the blank page for TOC
It's working for me. Use the suggested class as the following.
var pdf = new HtmlToPdfDocument()
{
GlobalSettings = globalSettings,
Objects = { coverSettings, new TableOfContentsSettings(), objectSettings }
};
Same here,
It works well for the first time and the next time, pdf file shows the blank page for TOC
Just hoping anyone can help with using TOC (Table of Contents) in DinkToPDF. Currently there is no settings for it (like there is for Header and Footer etc). Any ideas of how to wrap it in so we can use the feature that is available would be great