AddLinkToNamedAction

Annotations and hotspot links, Page properties

Description

Adds a clickable hotspot rectangle to the selected page which triggers a PDF named action when activated. Named actions are viewer-controlled navigation commands defined in ISO 32000-1 §12.6.4.11, Table 194. The four standard names supported are NextPage, PrevPage, FirstPage, and LastPage. Unlike AddLinkToPage, no explicit destination page number is required — the viewer interprets the command at runtime.

Typical use: navigation buttons (Next / Previous / Home / End) on a page header or footer, where the destination is relative to the page the viewer is currently displaying.

Use the SetAnnotBorderColor function to change the colour of the hotspot border.

Syntax

Delphi

function TPDFlib.AddLinkToNamedAction(Left, Top, Width, Height: Double; NamedActionType: Integer; Options: Integer): Integer;

DLL

int DLAddLinkToNamedAction(int InstanceID, double Left, double Top, double Width, double Height, int NamedActionType, int Options);

Parameters

LeftThe horizontal co-ordinate of the left edge of the hotspot rectangle
TopThe vertical co-ordinate of the top edge of the hotspot rectangle
WidthThe width of the hotspot rectangle
HeightThe height of the hotspot rectangle
NamedActionTypeSelects the named action to trigger: 0 = NextPage, 1 = PrevPage, 2 = FirstPage, 3 = LastPage. Values outside this range fall back to NextPage so the writer always emits a spec-conforming /N name.
OptionsBitmask controlling the link appearance. Bit 0 (value 1): draw a border around the hotspot rectangle. Bits 1–3 select the click highlight mode (2 = Invert, 4 = Outline, 8 = Push); when no highlight bit is set, Invert is used as the default. Same convention as AddLinkToWeb / AddLinkToPage.

Remarks

The annotation is PDF/A-compatible because no external resource is referenced. PDF 1.1 or later is required.