PDF Automation Station

PDF Automation Station

Creating PDF Form Fields Programmatically

Creating form fields using JavaScript can automate the process

David Dagley's avatar
David Dagley
Apr 06, 2024
∙ Paid
Share
woman wearing black t-shirt holding white computer keyboard
Photo by Kelly Sikkema on Unsplash

The addField method creates a form field with four mandatory input parameters:

  1. cName (The name of the field)

  2. cFieldType (The type of field)

  3. nPageNum (The 0-based number of the page to which the field will be added)

  4. 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.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture