AddLinkToNamedDestination
Annotations and hotspot links, Page properties
Description
Adds a clickable hotspot rectangle to the selected page which jumps to a named destination in the same PDF document. Use NewDestination and NewNamedDestination to register the target first, then create hotspots that reference the stable destination name instead of duplicating a page number and destination array.
Use the SetAnnotBorderColor function to change the color of the hotspot border.
Syntax
Delphi
Function TPDFlib.AddLinkToNamedDestination(Left, Top, Width, Height: Double; Const DestName: WideString; Options: Integer): Integer;
DLL
int DLAddLinkToNamedDestination(int InstanceID, double Left, double Top, double Width, double Height, const wchar_t * DestName, int Options);
Parameters
| Left | The horizontal co-ordinate of the left edge of the hotspot rectangle |
|---|---|
| Top | The vertical co-ordinate of the top edge of the hotspot rectangle |
| Width | The width of the hotspot rectangle |
| Height | The height of the hotspot rectangle |
| DestName | The named destination to jump to. The name should already exist in the document name tree, normally through NewNamedDestination |
| Options | Bitmask 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 |
Return values
| 0 | DestName was empty or the link could not be created |
|---|---|
| 1 | The named-destination link was added to the selected page |
Remarks
The link annotation writes a GoTo action whose destination is the named destination string. This keeps hotspots stable when pages are inserted or moved after the named destination has been created.