Actions

PDF includes a wide variety of standard action types, whose characteristics and behaviour are defined by an action dictionary. These are defined in this submodule.

Trigger events are the other component of actions, and are specific to their associated object.

class pypdf.actions.Action[source]

Bases: DictionaryObject, ABC

An action dictionary defines the characteristics and behaviour of an action.

class pypdf.actions.JavaScript(java_script: str)[source]

Bases: Action

Upon invocation of an ECMAScript action, a PDF processor shall execute a script that is written in the ECMAScript programming language. ECMAScript extensions described in ISO/DIS 21757-1 shall also be allowed.

Parameters:

java_script – A text string containing the ECMAScript script to be executed.

class pypdf.actions.PageTrigger(*values)[source]

Bases: StrEnum

Trigger event entries in a page object’s additional-actions dictionary.

OPEN = 'open'

Trigger an action when the page is opened.

CLOSE = 'close'

Trigger an action when the page is closed.