delete_actions

Delete action info

Usage

pdftl <input> delete_actions [<selector>...] output <output>

Details

The delete_actions operation deletes interactive actions and event triggers from the PDF. This is particularly useful for sanitizing files by removing executable scripts, external URL requests, or dynamic triggers, reducing the document’s security attack surface.

Without selectors, all actions are cleanly purged across the entire document.

Supported Target Areas

All action-bearing elements and trees are fully swept:

  • Catalog Level: Removes /OpenAction and /AA entries in the document catalog.

  • Names Tree: Completely purges and drops /Names -> /JavaScript libraries.

  • Page Objects: Removes /AA dictionaries from all matching pages.

  • Annotations: Removes activation /A and additional action /AA triggers from page annotations.

  • Outlines (Bookmarks): Clears action /A entries inside the outline tree.

  • AcroForm Fields: Wipes out /AA formatting, validation, keystroke, and calculation event blocks from interactive form elements.

  • Sequential Sub-chains (/Next Trees): Recursively detaches or removes matched actions nested inside hierarchical action paths.

Filtering Syntax

Actions can be filtered using the same selector syntax as dump_annots and modify_annots. The general format is: [page-range]/[ActionType]([Property=Value], ...)

  • Page Range: Page specs (e.g., 1-3, odd, even). Only page-specific actions will be deleted.

  • Action Type: Subtype of the action to target (e.g. /JavaScript, /Launch, /URI, /SubmitForm, /GoTo).

  • Properties: Matches key-value targets inside action dictionaries (e.g., targeting a specific launch file path or JavaScript snippet).

Examples

Delete all actions from in.pdf

pdftl in.pdf delete_actions output out.pdf

Delete only JavaScript actions

pdftl in.pdf delete_actions /JavaScript output out.pdf

Strip high-risk launch actions and form submission handlers

pdftl in.pdf delete_actions /Launch /SubmitForm output out.pdf

Delete JavaScript actions specifically on Page 1

pdftl in.pdf delete_actions "1/JavaScript" output out.pdf

Tags: in_place, actions, delete

Source: pdftl.operations.delete_actions

Read online: https://pdftl.readthedocs.io/en/latest/operations/delete_actions.html

Type: Operation