Click here to Skip to main content
15,878,048 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to add html checkbox,radiobutton,textbox in pdf using itextstarp.Am using this code.

StringWriter stringWriter = new StringWriter(); MemoryStream stream = new 

        var viewData = ViewData;

        ViewEngineResult viewEngineResult = 
       ViewEngines.Engines.FindView(ControllerContext, "ABCDFORM", null);
        ViewContext viewContext = new ViewContext(ControllerContext, 
       viewEngineResult.View, viewData, new TempDataDictionary(), stringWriter);
        viewEngineResult.View.Render(viewContext, stringWriter);

        // Get the view HTML string
        string htmlToConvert = stringWriter.ToString();
        StringReader sr = new StringReader(htmlToConvert);

        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 0f, 0f);
        PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);

        XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr);

        string fileName = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");

        return File(stream.ToArray(), "application/pdf", string.Format("{0}.pdf", 

In ABCDFORM is a my view,I am working on MVC.and am create ABCDFORM as html

I need add html checkbox,radiobutton in pdf.

What I have tried:

I tried to add checkbox,radiobutton in pdf using itextsharp.
Updated 14-Mar-19 0:36am
Maciej Los 14-Mar-19 5:19am    
Promis Patel 14-Mar-19 6:30am    
Because i change the structure
Please help

1 solution

Share this answer
Promis Patel 14-Mar-19 8:44am    
I need mvc code with itextsharp
Maciej Los 14-Mar-19 8:54am    
And do i have to write it for you? Sorry, but it's your job!
Promis Patel 14-Mar-19 9:02am    
No, do not write please check my question i am already working on that but i getting some issues when using HTMl textbox,checkbox...

I need only suggestion

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900