Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can someone fix the code below html CSS. (it convert the html textbox to PDF fil

ID: 3694825 • Letter: C

Question

 can someone fix the code below html CSS. (it convert the html textbox to PDF file)  <asp:Label ID="UserID" runat="server" BorderStyle="Double"></asp:Label>      private void PdfFiles()     {         Response.ContentType = "application/pdf";         Response.AddHeader("content-disposition", "attachment;filename=" + Decrypt(Request.QueryString["id"].ToString()) + ".pdf");         Response.Cache.SetCacheability(HttpCacheability.NoCache);         StringWriter sw = new StringWriter();         HtmlTextWriter hw = new HtmlTextWriter(sw);         panelView.RenderControl(hw);         StringReader sr = new StringReader(sw.ToString());         Document pdfDoc = new Document(PageSize.A4, 40f, 10f, 10f, 10f);         HTMLWorker htmlparser = new HTMLWorker(pdfDoc);         PdfWriter.GetInstance(pdfDoc, Response.OutputStream);         pdfDoc.Open();         htmlparser.Parse(sr);         pdfDoc.Close();         Response.End();     } 

Explanation / Answer

Answer:

This code wont work in ASP

you need itextsharp for CSS contents to work.

Export the html div contents to pdf using itextsharp.

Or you can use wkhtml to pdf tool which is a better html rendering engine.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote