Export Entire User Input Form to PDF in C#

Malam Malam 121 Reputation points
2022-02-14T15:59:15.65+00:00

I have a form that captures general user information like FirstName, LastName etc.
When user is done entering all information and clicks on the button Button1; I need to export the entire form to PDF.

Is there a way to do it?

First Name: <user Input> City: <user Input>
Last Name: <user Input> State: <user Input>
Address: <user Input> Zip: <user Input>

[Button1]

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
{count} votes

Accepted answer
  1. AgaveJoe 26,201 Reputation points
    2022-02-15T16:25:39.3+00:00

    I do not see iText7.pdfhtml anywhere in your references screenshot.

    174390-capture.png

    As far as I can tell you still have not installed the NuGet package. It's possible that there are build errors which stops the package installation. Usually build errors are very clear. Anyway, fix the build errors first. Once the project builds successfully then install iText7.pdfhtml.

    Pay closer attention to the details.

    0 comments No comments

12 additional answers

Sort by: Most helpful
  1. Sreeju Nair 11,606 Reputation points
    2022-02-14T16:13:58.15+00:00

    Yes, you can generate PDF from the data you have. iTextsharp is a pdf library that will help you generate pdf document from code. I published an article about generating the pdf from itextsharp, you can read this below.

    https://weblogs.asp.net/sreejukg/create-pdf-document-using-itextsharp-in-asp-net-4-0-and-memorymappedfile

    hope this helps

    0 comments No comments

  2. Malam Malam 121 Reputation points
    2022-02-14T16:53:35.69+00:00

    Thanks but this is not what I am looking for; I already know how to export GridView data to PDF.
    My question was "how to export the entire form that include 'captions' and 'user inputs' to PDF"


  3. Sreeju Nair 11,606 Reputation points
    2022-02-14T17:58:48.203+00:00

    The article was about how to use iTextsharp to generate pdf. it is possible to generate form. Refer the following sample.

    https://kb.itextpdf.com/home/it7kb/ebooks/itext-7-converting-html-to-pdf-with-pdfhtml/chapter-7-frequently-asked-questions-about-pdfhtml/can-i-convert-an-html-form-to-a-pdf

    0 comments No comments

  4. Malam Malam 121 Reputation points
    2022-02-14T19:20:40.877+00:00

    I've looked at that example and still not been able to see how it would convert asp page to pdf.
    Also, I did have all references to iTextSharp but the sample code still generates errors everywhere in the code. For example.
    ConverterProperties properties = new ConverterProperties(); * Error on ConverterProperties
    PdfReader pdfReader = new PdfReader(pdfStream); *
    Error on PdfReader