VOOZH about

URL: https://ironpdf.com/nodejs/examples/form-data/

⇱ Code Example: Create PDF Forms with HTML in .NET 10 | IronPDF for Node.js


Skip to footer content
PDF Forms
import {PdfDocument} from "@ironsoftware/ironpdf";

(async () => {
 // Define the HTML content with editable form fields
 const formHtml = `
 <html>
 <body>
 <h2>Editable PDF Form</h2>
 <form>
 First name: <br> <input type='text' name='firstname' value=''> <br>
 Last name: <br> <input type='text' name='lastname' value=''> <br>
 <br>
 <p>Please specify your gender:</p>
 <input type='radio' id='female' name='gender' value='Female'>
 <label for='female'>Female</label> <br>
 <br>
 <input type='radio' id='male' name='gender' value='Male'>
 <label for='male'>Male</label> <br>
 <br>
 <input type='radio' id='non-binary/other' name='gender' value='Non-Binary / Other'>
 <label for='non-binary/other'>Non-Binary / Other</label>
 <br>
 <p>Please select all medical conditions that apply:</p>
 <input type='checkbox' id='condition1' name='Hypertension' value='Hypertension'>
 <label for='condition1'> Hypertension</label><br>
 <input type='checkbox' id='condition2' name='Heart Disease' value='Heart Disease'>
 <label for='condition2'> Heart Disease</label><br>
 <input type='checkbox' id='condition3' name='Stoke' value='Stoke'>
 <label for='condition3'> Stoke</label><br>
 <input type='checkbox' id='condition4' name='Diabetes' value='Diabetes'>
 <label for='condition4'> Diabetes</label><br>
 <input type='checkbox' id='condition5' name='Kidney Disease' value='Kidney Disease'>
 <label for='condition5'> Kidney Disease</label><br>
 </form>
 </body>
 </html>
 `;

 // Configure render options
 const options = {
 createPdfFormsFromHtml: true,
 };

 // Render HTML content to a PDF with editable forms
 const pdf = await PdfDocument.fromHtml(formHtml, { renderOptions: options });

 // Save the new PDF
 await pdf.saveAs("formField.pdf");
})();

PDF Forms

HTML with form fields can also be rendered to PDF with the form field information and functionality intact. Creating an editable PDF form from HTML content involves defining an HTML form with various input fields like text fields, radio buttons, and checkboxes. These form elements allow users to input data and make selections.

To achieve this, set the createPdfFormsFromHtml option to true. This option specifies that the HTML form should be converted into an editable PDF form.

Next, render the HTML content into a PDF document using the PdfDocument.fromHtml method. Pass the specified rendering options as an object parameter.

Finally, export the editable form field PDF as a new PDF file named "formField.pdf" using the saveAs method.

To learn more about generating PDF forms from HTML content, visit the IronPDF Product Page for detailed information and examples.

<a href="https://github.com/iron-software/IronPdfNode.Examples/tree/main/examples/form-data" class="code_content__related-link__doc-cta-link">Explore Code Examples for Creating PDF Forms from HTML</a>
<a href="https://github.com/iron-software/IronPdfNode.Examples/tree/main/examples/form-data" class="code_content__related-link__doc-cta-link">Explore Code Examples for Creating PDF Forms from HTML</a>
HTML
Ready to Get Started?
Version: 2026.5 just released

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.

Try IronPDF for Free
Get Set Up in 5 Minutes
  1. Download and install Node.js 12+.
  2. Execute the above command in the terminal.
Licenses from $749

Have a question? Get in touch with our development team.

Now you've installed with NPM
Your browser is now downloading IronPDF

Next step: Start free 30-day Trial

No credit card required

  • Test in a live environment
  • Fully-functional product
  • 24/5 technical support

Thank You

Your trial key should be in the email.
If it is not, please contact
support@ironsoftware.com
Get your free 30-day Trial Key instantly.
Thank you.
If you'd like to speak to our licensing team:
πŸ‘ badge_greencheck_in_yellowcircle
The trial form was submitted
successfully.

Your trial key should be in the email.
If it is not, please contact
support@ironsoftware.com

Have a question? Get in touch with our development team.
No credit card or account creation required
Now you've installed with NPM
Your browser is now downloading IronPDF

Next step: Start free 30-day Trial

No credit card required

  • Test in a live environment
  • Fully-functional product
  • 24/5 technical support
Thank you.
View your license options:
Thank you.
If you'd like to speak to our licensing team:
Have a question? Get in touch with our development team.
Have a question? Get in touch with our development team.
Talk to Sales Team

Book a No-obligation Consult

How we can help:
  • Consult on your workflow & pain points
  • See how other companies solve their .NET document needs
  • All your questions answered to make sure you have all the information you need. (No commitment whatsoever.)
  • Get a tailored quote for your project's needs
Get Your No-Obligation Consult

Complete the form below or email sales@ironsoftware.com

Your details will always be kept confidential.

Trusted by Millions of Engineers Worldwide
Book Free Live Demo

Book a 30-minute, personal demo.

No contract, no card details, no commitments.

Here's what to expect:
  • A live demo of our product and its key features
  • Get project specific feature recommendations
  • All your questions are answered to make sure you have all the information you need.
    (No commitment whatsoever.)
CHOOSE TIME
YOUR INFO
Book your free Live Demo

Trusted by Millions of Engineers Worldwide

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me