English | 日本
BCL Technologies
Shopping CartContact Us
BCL easyPDF SDK

Process PDF Form Fields in C#

Benefits

  • Extract, insert, and update data in PDF Forms.

Code Snippet

Download the input.pdf form (line 27 below)

// this example takes the first two fields in a PDF template
// which are Name and Address, and populates them with 
// values of "BCL Technologies" and "Santa Clara, CA"
 
Type type = Type.GetTypeFromProgID("easyPDF.Loader.7");
Loader oLoader = (Loader)Activator.CreateInstance(type);
 
PDFDocument oDocument = (PDFDocument)oLoader.LoadObject("easyPDF.PDFDocument.7");
 
oDocument.Open(Server.MapPath(@".\input.pdf"));
 
// get all form fields from the PDF
 
FormFields oFormFields = oDocument.FormFields;

// get the first form field
FormField oFormField = oFormFields[0];
 
TextField oTextField;
 
if (oFormField.Type == docFormFieldType.DOC_FRMTYPE_TEXT && oFormField.Name == "Name")
    {
        // set Name to "BCL Technologies"
        oTextField = (TextField)oFormField;
        oTextField.Value = "BCL Technologies";
    }

// get the second form field
oFormField = oFormFields[1];

if (oFormField.Type == docFormFieldType.DOC_FRMTYPE_TEXT && oFormField.Name == "Address")
    {
        // set Address to "Santa Clara, CA"
        oTextField = (TextField)oFormField;
        oTextField.Value = "Santa Clara, CA";
    }
oDocument.SaveAs(Server.MapPath(@".\output.pdf"));
                  

 

Download Free Trial

Request Pricing

QuickStart Video
Watch a QuickStart Video to see how easy it is to convert Word to PDF.

Complete PDF Features
  • “easyPDF SDK setup was very straightforward, unlike our experience with other products. We wrote just a few lines of code to start using it.” Read the case study
  • “We evaluated many PDF tools and drivers. We even wrote our own. Except for BCL’s easyPDF SDK, all had limitations we couldn’t live with. Some only converted from MS Office and not very well. Others could not do annotation or text stamping on PDF documents. None were as easy to use and as easy to integrate.” Read the case study
-
 
BCL
© 1993 - , BCL Technologies.
All other trademarks are the property of their respective owners.