Actions Reference

class pdfnaut.objects.actions.Action[source]

Bases: PdfDictionary

An action instructs the PDF reader to perform an action such as opening an application, going to a page in the document, or playing a sound, when activating an annotation or outline item.

See ISO 32000-2:2020 § 12.6 “Actions” for details.

__init__(subtype: Literal['GoTo', 'GoToR', 'GoToE', 'GoToDPart', 'Launch', 'Thread', 'URI', 'Sound', 'Movie', 'Hide', 'Named', 'SubmitForm', 'ResetForm', 'ImportData', 'SetOCGState', 'Rendition', 'Trans', 'GoTo3DView', 'JavaScript', 'RichMediaExecute'], next_action: list[Action] | Action | None = None) None[source]
property next_action: list[Action] | Action | None

The next action or sequence of actions that shall be performed after this action.

subtype: Annotated[Literal['GoTo', 'GoToR', 'GoToE', 'GoToDPart', 'Launch', 'Thread', 'URI', 'Sound', 'Movie', 'Hide', 'Named', 'SubmitForm', 'ResetForm', 'ImportData', 'SetOCGState', 'Rendition', 'Trans', 'GoTo3DView', 'JavaScript', 'RichMediaExecute'], 'name']

The type of action.

Refer to ISO 32000-2:2020 “Table 201 - Action types” for available types.

class pdfnaut.objects.actions.GoToAction[source]

Bases: Action

A go-to action changes the view to a specified destination.

See ISO 32000-2:2020 § 12.6.4.2 “Go-To actions” for details.

__init__(destination: PdfName | PdfHexString | bytes | Destination, next_action: list[Action] | Action | None = None) None[source]
property destination: PdfName | PdfHexString | bytes | Destination

The destination to jump to.

subtype: Annotated[Literal['GoTo', 'GoToR', 'GoToE', 'GoToDPart', 'Launch', 'Thread', 'URI', 'Sound', 'Movie', 'Hide', 'Named', 'SubmitForm', 'ResetForm', 'ImportData', 'SetOCGState', 'Rendition', 'Trans', 'GoTo3DView', 'JavaScript', 'RichMediaExecute'], 'name']

The type of action.

Refer to ISO 32000-2:2020 “Table 201 - Action types” for available types.

class pdfnaut.objects.actions.URIAction[source]

Bases: Action

A URI action causes a URI or uniform resource identifier to be resolved.

See ISO 32000-2:2020 § 12.6.4.8 “URI actions” for details.

__init__(uri: str, is_map: bool = False, next_action: list[Action] | Action | None = None) None[source]
is_map: bool

Whether to track the mouse position when the URI is resolved.

subtype: Annotated[Literal['GoTo', 'GoToR', 'GoToE', 'GoToDPart', 'Launch', 'Thread', 'URI', 'Sound', 'Movie', 'Hide', 'Named', 'SubmitForm', 'ResetForm', 'ImportData', 'SetOCGState', 'Rendition', 'Trans', 'GoTo3DView', 'JavaScript', 'RichMediaExecute'], 'name']

The type of action.

Refer to ISO 32000-2:2020 “Table 201 - Action types” for available types.

uri: str

The uniform resource identifier (URI) to resolve.

pdfnaut.objects.actions.action_into(mapping: PdfDictionary) Action[source]

Converts a dictionary mapping into a corresponding Action subclass.