Save email as html and to pdf

step 1 : save outlook mail message and save the mail as html
step 2 : Use invoke code to write the following expression

Console.WriteLine(“PDF creation started”)
Console.WriteLine(htmlFilePath)

itext.Html2pdf.HtmlConverter.ConvertToPdf(New FileStream(htmlFilePath, FileMode.Open), New FileStream(pdfFilePath, FileMode.Create))

Console.WriteLine(“PDF created successfully!”)

You need to install the follwing packages before invoking the following code.

itext.pdfhtml
itext.Bouncy-castle FIPS adapter module