Automated form-field styling: Goodbye Times New Roman, hello Acrobat.

Michael Streubert
Michael Streubert
Senior Art Director

Have you ever had to create an Indesign document that incorporated form fields spread across many pages? Has a co-worker discovered you sobbing quietly at your desk while manually updating font styles using acrobat’s “Prepare Forms” tool? Well, if you said “No” or “What the H$%# are you talking about” then read no more. 

If you answered “Yes!”, I’m sorry you have to work on forms, but hopefully, this will save you a ton of time. 

I recently discovered a simple Javascript for editing text field styles in a PDF document. While Indesign is a great production tool, the program is severely limited in its ability to format interactive form fields. While it allows a user to specify type size, there are really no other formatting options. By default, Indesign will export your PDF form fields using Times New Roman, left aligned only. Surprise, Times New Roman doesn’t always look great, and you may want to change it.


For demonstration purposes, I’ve built a very concise registration form, but imagine you’ve built a large legal document full of editable form fields that goes on for pages and pages and pages… and pages.

(Looks like this in Indesign)

(but exports like this in Acrobat)


You’ll notice Times New Roman doesn’t really match the sans serif format and the type might be larger than you want.

Fortunately, there’s a great workaround I discovered over on the Adobe forums. (WARNING: THIS LINK INCLUDES INTERWEBZ DRAMA!!!)

The instructions are fairly straight-forward but I wanted to provide some visuals to show just how easy this script is to use. Also, in case there are other designers out there, who, like me, should have spent more time at the “Center for Kids Who Can’t Read Good.”


Open Acrobat. Select “Tools” from the menu. Scroll to the bottom and Click on the Action Wizard Icon.

This will open the Action Wizard tool. Start by (1) clicking on “New Action” in the toolbar. Click on (2) “More Tools” which will open a flyout. Select (3) “Execute Javascript”, followed by (4) the right arrow in between windows. Finally double click on (5) Specify Settings Javascript. 

This will open a new window where you will paste the following script:

for (var i = 0; i < numFields; i++) {
	var fName = getNthFieldName(i);
	var f = getField(fName);
	if (f.type === "text") {
//  	f.alignment ="center";
    	f.textSize = 6;
    	f.textFont = "Helvetica";
    	// Other properties go here


You’ll notice the script is going to resize all form fields to 6pt, as well as change them to Helvetica. Feel free to change “6” to whatever size you want and/or use any other common system font instead of Helvetica (Arial, Tahoma, Papyrus, etc). The Alignment is defaulted to “left” align, but as you can see the option to “center” text is available if you remove the “//” before that line of text.

Click “OK”, which will close the JavaScript Editor. Back to the Action panel click “Save” which will prompt you to name the script, something like “Form Field Text Editor”.

You’ll notice this new script will appear at the top of the right-hand column labeled “ACTIONS LIST”. 

Click on the action to use it. Select “Add Files” and use the finder to locate your PDF. Click the blue “Start” button to run the script. The JavaScript Editor window will open again and you’re welcome to tweak any of the options you set, although the script will only remember those overrides for this one instance.

Here you can see what the updated form would look once filed out. While this example’s properties would be easy to edit using the “Prepare Forms” tool in Acrobat, it becomes increasingly cumbersome when you have more than a handful of pages to edit. This script instantly updates every form field in the entire document, and you can even add multiple PDFs at a time to edit in bulk.

Obviously, this script isn’t going to solve world hunger or nuclear proliferation, but for now, it’s keeping at least one designer from sobbing quietly at his desk in front of co-workers. 

Let us know in the comments if you have any additional options to expand on this simple, yet effective script. Check out our other blogs for more tips for getting around the busy and complex world of marketing and design.

© Texas Creative. An Advertising Agency. All rights reserved. Privacy Policy | Login