PDF Automation Station

PDF Automation Station

Setting Form Field Properties Programatically

Setting form field properties using JavaScript can automate the process

David Dagley's avatar
David Dagley
Apr 13, 2024
∙ Paid
Share
person holding pencil near laptop computer
Photo by Scott Graham on Unsplash

If you will be setting form field properties while creating and positioning a form field programatically using the addField method you should first define a variable for the field by running the following script in the console like this:

var f = this.addField("MyField", "text", 0 , [0, 18, 72, 0]);

Now you can use f instead of typing this.getField("MyField") for each field property you are going to set:

f.alignment="center"; //sets the field alignment to center
f.fillColor=color.yellow; //sets the fill color of the field to yellow
f.textColor=color.blue; //sets the text color of the field to blue
f.textFont="Times-Bold"; //sets the font of the field to Times Bold

Get the course above, and a suite of automation tools for FREE with a Professional subscription.

This post is for paid subscribers

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