NAME

PDF::Make::Action - PDF action objects for navigation and interactivity

SYNOPSIS

use PDF::Make::Document;

my $doc = PDF::Make::Document->new();
$doc->add_page(612, 792);

# Create a URI action
my $action = $doc->action_uri('https://perl.org');

# Create link annotation with action
$doc->add_link_with_action(100, 700, 200, 720, $action);

DESCRIPTION

PDF::Make::Action represents PDF action objects that define behaviors triggered by events like clicking a link or bookmark.

Actions are created via the PDF::Make::Document factory methods:

  • action_uri($uri) - Link to web URL

  • action_goto($page_index, $dest_type, ...) - Internal navigation

  • action_named($name) - Named actions (NextPage, PrevPage, etc.)

  • action_javascript($script) - Execute JavaScript

  • action_gotor($file, $page, $new_window) - External PDF

CONSTANTS

Action Types

GOTO        - Navigate to destination in same document
GOTOR       - Navigate to destination in another PDF
URI         - Open a URI (web link)
NAMED       - Execute a named action
JAVASCRIPT  - Execute JavaScript code
HIDE        - Show/hide annotations
LAUNCH      - Launch external application

Named Actions

NEXTPAGE    - Go to next page
PREVPAGE    - Go to previous page
FIRSTPAGE   - Go to first page
LASTPAGE    - Go to last page
PRINT       - Print the document

Highlight Modes

HIGHLIGHT_NONE     - No visual feedback
HIGHLIGHT_INVERT   - Invert colors (default)
HIGHLIGHT_OUTLINE  - Draw outline
HIGHLIGHT_PUSH     - Push button effect

METHODS

type

my $type = $action->type;

Returns the action type constant.

obj_num

my $num = $action->obj_num;

Returns the PDF object number (0 if not yet written).

write

my $num = $action->write;

Writes the action to the PDF document and returns the object number.

chain

$action->chain($next_action);

Chains another action to execute after this one.

SEE ALSO

PDF::Make::Document, PDF::Make