HTML to PDF
Add this nuget package HtmlRenderer.PdfSharp Generate a PDF document string htmlString = "<h1>Document</h1> <p>This is an HTML document which is converted to a pdf file.</p>"; PdfDocument pdfDocument = PdfGenerator.GeneratePdf(htmlString, PageSize.A4); To save to disk pdfDocument.Save("C:/temp/HTML to PDF Document.pdf"); To convert to byte array using (MemoryStream ms = new MemoryStream()) { pdfDocument.Save(ms); byte[] byteArray = ms.ToArray(); .... }