Reputation: 1442
I'm trying to set up NReco HTML to PDF generation and having an issue. It generates the PDF but when I open the PDF with adobe reader, it automatically opens the "Bookmarks" side tab consuming quite a bit of screen real estate (about 1/3 of the window).
This is unnecessary, because the PDF is one page long. From what I can tell, this is because the PDF has a table of contents generated by taking the HTML header elements.
I updated my code to attempt to turn of table of contents generation:
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter
{
GenerateToc = false
};
var byteArray = htmlToPdf.GeneratePdf(emailHtmlBody);
var memStream = new MemoryStream(byteArray);
return memStream;
but making this change seems to have no effect. Any help with this would be greatly appreciated.
Upvotes: 0
Views: 839
Reputation: 9235
it automatically opens the "Bookmarks" side tab
this is not a table of contents in fact; in terms of wkhtmltopdf (which is internally used by NReco.PdfGenerator) this is called 'outline' and you can disable its generation by H1-H6 tags in the following way:
htmlToPdf.CustomWkHtmlArgs = " --no-outline ";
Complete list of wkhtmltopdf options may be found here: https://wkhtmltopdf.org/usage/wkhtmltopdf.txt
Upvotes: 1