Creating PDF Form Fields Programmatically
Creating form fields using JavaScript can automate the process
The addField method creates a form field with four mandatory input parameters:
cName (The name of the field)
cFieldType (The type of field)
nPageNum (The 0-based number of the page to which the field will be added)
oCoords (An array of four numbers representing the rectangle box of the field’s position, or the rect property of the field)
Since all inputs are mandatory it's not necessary to use the parameter names if you use the correct order: this.addField(Name, Type, Page Number, Rect). For example, the following script will create a text field named MyField on the first page of the PDF, 1 inch wide by 1/4 inch high at the bottom left of the page:
this.addField("MyField", "text", 0 , [0, 18, 72, 0]);
Get the course above, and a suite of automation tools for FREE with a Professional subscription.
Field Types
cFieldType can be one of the following:
text
button
checkbox
radiobutton
combobox
listbox
signature
combobox is often referred to as a "dropdown" field.