Introducing the Practical:PDF Fix Form Utility

Preview

Preview

I wrote the original version of this script nearly 4 years ago when I was employed by Adobe and it seems that Apple still hasn’t done anything about the problem it solves. So… it’s time for an update.

Users of Acrobat and Reader continue to run into problems where PDF forms are being filled out by users of Preview on Mac OS X 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 it’s “appearance” are two completely different things. This lets 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 Mac Preview.

In this case, Mac OSX’s Preview isn’t writing any appearance information into the fields nor it is setting the “needs appearance” flag which tells a viewer to 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 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 function is that when Acrobat or Reader displays the file, the fields are blank until you click into the field displaying the field value.

One way to correct the form is to take some action which forces Acrobat to regenerate the appearances without actually changing the values. In my original script, I flipped the multiline option on text fields but that didn’t help much for list boxes. Additionally, now that Adobe Reader XI can save forms without the file needing to be Reader Extended, I felt it was time for an update.

So…this new version now goes through each field, regardless of field type and toggles the “delay” property of the field. According the 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 makes Acrobat create proper appearances for all the fields in the document without changing the values and without causing recalculations. After running the script, the field values should appear.

The new version will work in Acrobat 9, Acrobat X, Acrobat XI and Adobe Reader XI.

Installation:

Begin by downloading the Practical:PDF Fix Form Utility.

Windows Installation:

  1. Enter “%appdata%” in the file Explorer window path bar and press enter. Depending on the version of Windows you are using, you’ll end up in a different folder but in all cases you should see an “Adobe” folder in the location that just opened.
  2. Open the “Adobe” folder. You should see an “Acrobat” folder within the “Adobe” folder.
  3. Open the “Acrobat” folder if you have Acrobat. If you are a Reader user, you may need to create a folder and name it “Acrobat”.
  4. Continue the instructions based on the version of Acrobat or Reader you have.

Acrobat 9.x

  1. You should see a “9.0” folder within the “Acrobat” folder.
  2. Open the “9.0” folder.
  3. If you see a “JavaScripts” folder, open it. If not, create it.
  4. Move “PPDF_fixFields.js” to the “JavaScripts” folder.
  5. Restart Acrobat if it’s running.

Acrobat X and XI

  1. If not already present, create a new folder called “Privileged” within the “Acrobat” folder.
  2. Open the “Privileged” folder.
  3. If not already present and depending on your version, create a folder named either “10.0” or “11.0”. In the remaining instructions, I’ll refer to this as the “version number folder”
  4. Open the version number folder.
  5. If not already present, create a new folder called “JavaScripts” within the version number folder.
  6. Open the “JavaScripts” folder.
  7. Move “PPDF_fixFields.js” to the “JavaScripts” folder.
  8. Restart Acrobat or Reader if it’s running.

Mac Installation:

  1. Find your version of the directory below.
    Acrobat 9
    /Macintosh HD/Users/USERNAME/Library/Application Support/Adobe/Acrobat/9.0_x86/JavaScripts/
    Acrobat X
    /Macintosh HD/Users/USERNAME/Library/Application Support/Adobe/Acrobat/10.0/JavaScripts/
    Acrobat XI
    /Macintosh HD/Users/USERNAME/Library/Application Support/Adobe/Acrobat/11.0/JavaScripts/
  2. Move “PPDF_fixFields.js” to the “JavaScripts” folder.
  3. Restart Acrobat if it’s running.

Use:

Look at the bottom of the “Edit” menu for “Fix Field Appearances”. Open your form and then select the menu item. Your fields should magically show up.

Leave a Reply

Powered by WordPress. Designed by Woo Themes