The Fix Fields Utility

for Adobe Acrobat Pro DC

The practicalPDF Fix Fields Utility

I wrote the original version of this script nearly 15 years ago when I was employed by Adobe and it seems that Apple still hasn’t done anything about the problem it solves.

The Problem:

Users of Acrobat and Reader continue to run into problems where PDF forms are being filled out by users of Preview on macOS and sent back to folks with Acrobat or Reader. Unfortunately, when the recipients open the file, form fields appear blank until they click into them and then go blank again when they exit the field.

This seems a little strange… and it is… but there’s a very good technical explanation. In PDF, the value of a field and its “appearance” are two completely different things. Appearances let form authors do some pretty cool tricks with date strings and other types of formatting but can cause problems with non-conforming PDF viewers like Preview for macOS.

The problem is that Preview isn’t writing any appearance information into the fields nor it is setting the “needs appearance” flag so that the PDF viewer will automatically generate an appearance for the field. The “needs appearance” flag is intended to tell the application rendering the PDF file that the data in a field has been changed by some other tool and that it didn’t also generate an appearance for the field… a server script that pre-populates fields for example. The result of not performing either of these functions is that when Acrobat or Reader displays the file, the fields are blank until you click into the field displaying the field value.

The Solution:

One way to correct the form is to take some action which forces Acrobat to regenerate the appearances without actually changing the values. The script iterates through each field and toggles the “delay” property of the field. According the Acrobat JavaScript SDK…

The “delay” property delays the redrawing of a field’s appearance. It’s generally used to buffer a series of changes to the properties of the field before requesting that the field regenerate its appearance. Setting the property to true forces the field to wait until delay is set to false. The update of its appearance then takes place, redrawing the field with its latest settings.

This simple trick forces Acrobat to create proper appearances for all the fields in the document without changing the values and without causing recalculations. After running the action, the field values should appear.

Using the Tool:

Download the practicalPDF Fix Fields Utility file then choose Tools > Action Wizard and use the Manage Custom Commands dialog box to import it. After importing, you should see a new Custom Command named pPDF: Fix Fields Utility. Open your problem form and press run the new command. Agree to the terms of use and the form will be fixed.