Link

AcroForm JavaScript Support

AcroForm JavaScript is not limited to one section of the PDF, it can be found in various areas and can sometimes interconnect with each other.

This document describes the possible AcroForm JavaScript implementations and notes which are supported in FormVu (when PDF JavaScript is enabled).

Form Field Events

Field events are custom JavaScript actions that are linked to a specific form field

The following events are supported:

  • A: when the field’s action occurs
  • E: when the cursor enters the field area
  • X: when the cursor exits the field area
  • D: when the mouse button is pressed in the field area
  • U: when the mouse button is released in the field area (A takes precedence)
  • K: when a text character is modified in the field
  • C: when the calculation event is run

The following events have some support (Not supported for Checkboxes/Radio buttons yet):

  • Fo: when the field gains focus
  • Bl: when the field loses focus

The following are not yet supported:

  • PO: when the page containing the field is opened
  • PC: when the page containing the field is closed
  • PV: when the page containing the field is visible
  • PI: when the page containing the field is no longer visible
  • F: run before the field is formatted for display
  • V: validation run when a field value is changed

Page Events

Page events are custom JavaScript actions that are linked to specific pages of a PDF form

The following event has partial support:

  • O: page open

The following event is not yet supported:

  • C: page close

Document Level

A PDF form file can also have custom JavaScript defined at the document level. There are 2 places where it might occur:

Names Dictionary

A PDF can define custom JavaScript globally in the file, this JavaScript can then be called by any other custom JavaScript found in the PDF, such as with form field events or page events.

At present, global definitions in the document are not supported in FormVu. This is a feature that is on the FormVu development roadmap.

Document Events

The following events for documents are not supported:

  • WC: before the document closes
  • WS: before the document saves
  • DS: after the document is saved
  • WP: before the document prints
  • DP: after the document has printed

Annotation Events

The only PDF annotations that can contain custom JavaScript are Screen/Rendition annotations, which are used to display media.

Events for these annotations are unsupported in FormVu.