Posts

Showing posts from September, 2016
Generate PDF from HTML in c# You can use itextSharp and itextSharp.xmlWorker libraries to generate and download PDF from HTML, simply add reference of both the DLLs that are open source.The code is given below:             Byte[] bytes;             var ms = new MemoryStream();             var doc = new Document(PageSize.A4);             var writer = PdfWriter.GetInstance(doc, ms);             doc.Open();             var html = @"<strong>hi</strong>";             var sr = new StringReader(html);             var htmlWorker = new HTMLWorker(doc);             htmlWorker.Parse(sr);             doc.Close();             bytes = ms.ToArray(); ...