C# Exporting Webform to PDF using ITextSharp RRS feed

  • Question

  • I have a webform with data entry fields like attached image. I am trying to use ITextsharp to export this form to pdf but the textbox values and dropdownlist selection is not reflecting in the pdf. can anyone please sujject me how to export the textbox and dropdownlist values to pdf. Below is the code i am using.

    Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=AppraisalForm.pdf");
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            StringReader sr = new StringReader(sw.ToString());
            Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            List<IElement> elements = HTMLWorker.ParseToList(new StringReader(sw.ToString()), null);
            foreach (IElement el in elements)


    • Moved by CoolDadTx Wednesday, December 11, 2019 3:44 PM Third party product
    Wednesday, December 11, 2019 2:58 PM

All replies

  • This forum is for C#-specific questions only. Please post questions related to third party products like iTextSharp in their forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, December 11, 2019 3:44 PM