IRONSOFTWAREHOME
USE CASES

How to Create Fillable PDF Forms from HTML in C#

Curtis Chau
Curtis Chau
Updated: July 5, 2026

Intake forms, applications, surveys, and onboarding paperwork all share a pattern: a recipient needs to fill in fields and return the document. A static PDF cannot do that, and printing, scanning, and re-keying wastes everyone's time. IronPDF generates fillable PDF forms in C#, either from HTML markup the team already has or by placing fields programmatically onto an existing document.

The Business Problem

A healthcare provider needs patient intake forms, an insurer needs applications, an HR team needs onboarding documents. Each should arrive as a PDF the recipient can complete on screen, ideally with known details already filled in. Building these by hand in a PDF editor does not scale, and maintaining a separate form layout duplicates the web version that often already exists.

Generating a Form from HTML

Enabling one rendering option turns standard HTML form elements into interactive PDF fields, so existing markup becomes a fillable document.

using IronPdf;

string formHtml = @"
<html><body>
  <h2>Patient Intake</h2>
  <form>
    First name: <input type='text' name='firstname' value=''><br>
    Address: <textarea name='address' rows='4' cols='50'></textarea><br>
    Completed: <input type='checkbox' name='completed'><br>
    Priority:
    <select name='priority'>
      <option value='high'>High</option>
      <option value='low'>Low</option>
    </select>
  </form>
</body></html>";

var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
renderer.RenderHtmlAsPdf(formHtml).SaveAs("intake-form.pdf");
C#

Because each field has a name and a value, the same approach pre-fills a form from a database, so a renewal notice or application arrives with the recipient's details already populated and only the gaps left to complete.

Adding Fields to an Existing Document

When the base document did not come from HTML, such as a scanned form or a generated report needing an approval field, fields can be placed programmatically at exact coordinates.

using IronSoftware.Forms;

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Approval</h2>");

var textForm = new TextFormField("approver", "", pageIndex: 0, x: 100, y: 700, width: 150, height: 15);
pdf.Form.Add(textForm);

pdf.SaveAs("approval-form.pdf");
C#

Points to Plan For

  • Enable the form flag: Without CreatePdfFormsFromHtml set to true, HTML form elements render as static visuals rather than fillable fields. This is the most common reason a form is not editable.
  • Programmatic fields are coordinate-based: Fields added through code use absolute x, y, width, height, and a page index, which is precise but makes layout your responsibility.
  • Checkbox values: A checkbox uses "yes" and "no" rather than a boolean for its checked state.
  • Creating is not securing: Generating a form does not lock or sign it. Apply passwords, permissions, or signatures separately when the document needs protection.

Result

With one option for HTML forms and coordinate-based fields for everything else, teams ship fillable, pre-fillable documents that recipients complete on screen, with no manual form building. Full field types and options are in the create PDF forms guide.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
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
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required