PDF .NET Library Logo

Filling PDF Acro Forms

The following code snippet fills an Acro Form called "fw9.pdf" and creates a new PDF called "formfill.pdf"

C# sample:

PDFDocument doc = new PDFDocument("formfill.pdf");

string formFile = ("fw9.pdf");

doc.Pages.Delete(doc.CurrentPage);

doc.LoadPdf(formFile,"");

(doc.AcroForm.Fields["f1_01(0)"] as PDFEdit).Text = "Jim Smith";

(doc.AcroForm.Fields["f1_02(0)"] as PDFEdit).Text = "Acme Corp. Inc.";

(doc.AcroForm.Fields["c1_01(0)"] as PDFCheckBox).Checked = true;

(doc.AcroForm.Fields["c1_02(0)"] as PDFCheckBox).Checked = false;

doc.AcroForm.FlattenFormFields=true;

doc.Save();

 

 

Back to PDF Code Library