Script to Fix Mac OSX Form Fill and Save


I don’t know if you guys are hearing this as well, but I’ve started running into problems where Acrobat forms (AcroForms, not XFA) are being filled out by Mac OS X and sent back to folks with Acrobat and the fields appear blank until you click into them.

UPDATED 10/05/2011 – Now works with Acrobat X, Version 10.1.1 Fixed the error message popping up for each field.

UPDATED 1/28/2011 – The script has been updated to work with Acrobat X. Because the “Document” menu no longer exists, I move the script to load under the “Edit” menu.

UPDATED 3/18/2010 – There’s been some confusion about when to use this tool so I added some code to test if Mac was the last application to save the PDF file. If not, the menu item will be greyed out.

UPDATED 3/17/2010 – I added some additional code to not add the menu item if the script is running in the Adobe Reader and to be greyed out if there are no form fields on the document.

UPDATED 2/18/2010 – I fixed the “An internal error occurred” bug. Give it another shot if you’ve had problems.

It seems a little strange but there’s a good explanation. In PDF files, the value of a field and it’s appearance are two different things. This lets you do some pretty cool tricks with date strings and other types of formatting but can cause problems with non-conforming viewers.

In this case, Mac OSX’s isn’t writing any appearance into the fields nor it is setting the “needs appearance” flag. So when Acrobat displays the file, the fields are blank until you click into the field displaying the field value. 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 that didn’t also generate an appearance for the field, like a server script or something like that.

One way to correct the form is to take some action which forces Acrobat to regenerate the appearances without actually changing the values or the appearance. Flipping the multiline option seems to work well. So I wrote up a little script which will iterate over the fields and switch on and off the multiline value.

When the multiline option is toggled, Acrobat thinks it needs to re-layout the content of that field and regenerates the appearance.

Many thanks to Leonard Rosenthol for uncovering this issue for me, supplying the functional part of the script and writing most of the text above.

Installing the Script
1. Quit Acrobat if it is already running
2. Download the script and then copy the ADBE_JFG_fixFields.js file into the following location:

C:\Documents and Settings\USERNAME\Application Data\Adobe\Acrobat \9.0\JavaScripts


/Users/YOURUSER/Library/Application Support/Adobe/Acrobat/9.0_x86/JavaScripts

3. Restart Acrobat

4. Look at the bottom of the “Edit” menu for “Fix Field Appearances”.