What is a "PDF Action"?
When working with PDFs, an "Action" is a feature that triggers an automatic response based on user interaction. These actions can include going to another page when a bookmark, is clicked, performing calculations using form data, or playing multimedia elements like audio and video.
Common action types
The PDF specification defines several action types. A few of them cover almost all real-world use cases:
- GoTo, which jumps to a destination in the same document.
- GoToR and Launch, which open another file.
- URI, which opens a web address.
- Named, which runs a viewer command such as NextPage or Print.
- SubmitForm and ResetForm, which send or clear form data.
- JavaScript, which runs a script embedded in the document.
Where an action is attached
An action is never free-floating. It is attached to something the reader can interact with, or to an event. The usual carriers are bookmarks, link annotations and the widget annotations that make up a form.
Actions can also run on document events instead of a click, for example when a page is opened or closed, or when a document is about to be printed. Because an action can run JavaScript and access the network, viewers limit what they execute, and many disable scripting entirely by default.